convert double[] to array<double> Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
[Hugo]
Experienced Solver
Experienced Solver
Posts: 54
Joined: Sun Jul 02, 2006 8:05 pm

convert double[] to array<double>

Post by [Hugo] »

Hi,

I am struggling with conversion from a standard C array of double to a c++ standard type of array as array<double>... does anyone know how to deal with that kind of conversion ?

Thanks a lot,

Hugo
Arakageeta1
Knows some wx things
Knows some wx things
Posts: 38
Joined: Tue Oct 18, 2005 12:26 am

Post by Arakageeta1 »

This probably doesn't belong in a wxWidgets forum, but I'll try to answer your question anyway. I assume that when you mean array<> you mean vector<>?

If that is the case, then you must COPY your C array to a vector class.

Code: Select all

double blah[10] = {1,2,3,4,5,6,7,8,9,0};
std::vector<double> vecBlah(blah, blah+10);
This will copy the array blah to the internal buffer within the vector class.

If you have any more questions about std::vector (or any STL class), SGI's STL documentation is very good.
[Hugo]
Experienced Solver
Experienced Solver
Posts: 54
Joined: Sun Jul 02, 2006 8:05 pm

Post by [Hugo] »

Thank you so much for the answer and the ref !!!! :):):)

Hugo
Post Reply