someWhereElse
someWhereElse

Reputation: 15

How can I use a dynamic matrix as a parameter, of a function, in C++?

I'm reading a bmp image. So my matrix is dynamic. I'm learning its columns and rows size in runtime. I want to use this dynamic matrix as a parameter of a function.

func(w,h, inMatrix, outMatrix);

I want to call my function like this.

void func(int w,int h,?,?)
{
....
    outMatrix[x][y].R=inMatrix[x][y].R*someThing;
....
}

How can I define this function?

So ?=?

Thanks for helping!

Upvotes: 0

Views: 142

Answers (1)

Craig Bradley
Craig Bradley

Reputation: 63

Use a pointer to an object that wraps that behaviour? or use a reference to the matrix. I would avoid passing by copy due to performance issues.

Upvotes: 1

Related Questions