Re: how to pass a 1 dimension array pointer to a function taking a 2 dimensinoal array pointer?
- From: "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
- Date: Wed, 28 Mar 2007 22:31:41 -0400
Instead of using an array of pointers to a vector, use a pointer to an array
of vectors:
typedef float (*X)[3];
*or* :
F (reinterpret_cast<float (*)[3]> (zz));
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"JD" <jdt_young@xxxxxxxxx> wrote in message
news:eSiakhYcHHA.3484@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I have a very old library with a file prototype shown as below:
void F(float x[][3])
I want to pass a one dimension array as shown below:
float *z;
...
typedef float X[][3];
F(reinterpret_cast<X>(zz));
But the compiler complains that "cannot convert from 'float *' to 'float
[][3]'". Is there any other way to achieve the purpose? I just don't
want to copy my 1 dimension array to a 2 dimension array before calling F.
That requires lots of computational time.
The library is so old that it still used multiple dimensional structures.
Thanks for any help.
JD
.
- References:
- Prev by Date: Re: faq: different elements in one container,is it possible?
- Next by Date: Re: Where does LBN_SELCHANGE goes?
- Previous by thread: how to pass a 1 dimension array pointer to a function taking a 2 dimensinoal array pointer?
- Next by thread: Re: faq: different elements in one container,is it possible?
- Index(es):
Relevant Pages
|
Loading