简体   繁体   中英

How to convert array float* to float**?

I have a function expecting arguments like so:

fooReplace(float** input, float** output, int blockSize);

and I need to pass buffer containing two arrays of data into fooReplace . I can access buffer data like so:

float* data = buffer->getData(); // return float*;
int mBlockSize = buffer->getOffset(); //

but I cannot figure out how to convert it to float** so I can pass data into fooReplace .

I know this is basic C++ stuff, but I got stuck on this for days, and I cannot find any solution.

If it is for the cast you can do

float* data = buffer->getData(); // return float*;
int mBlockSize = buffer->getOffset(); //
float** data_ptr = &data; // is of type float**

However as @Cheers and hth. - Alf points out in his comment you should try to understand why fooReplace wants a pointer to pointer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM