By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,116 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,116 IT Pros & Developers. It's quick & easy.

convert valarray to basic array

P: n/a
Hi,

is there an efficient way to convert a valarray< double > into double[]
without using a loop to copy each value from the valarray to the basic
array?

I use a valarray because I need the mathematical operations of
valarray. Now I want to use an extern function to transform my
valarray. The input should be my valarray. But the input parameter of
the extern function is of type double[]. The extern function was
programmed by someone else and I don't want to change this code.

Hope you can help me.

Thanks in advance.

Kai I. H.

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> is there an efficient way to convert a valarray< double > into double[]
without using a loop to copy each value from the valarray to the basic
array?

I use a valarray because I need the mathematical operations of
valarray. Now I want to use an extern function to transform my
valarray. The input should be my valarray. But the input parameter of
the extern function is of type double[]. The extern function was
programmed by someone else and I don't want to change this code.


Well you could do the following:
SomeoneElsesFunction(&YourValarray[0], YourValarray.size());

Note that this is not to clean programming, I'm effectively accessing
the private pointer in the valarray that points to the interal array
used.

Jul 23 '05 #2

P: n/a
Ok, I see, this is a solution for my problem. Thanks.

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.