I apologize that I am still very new with C++, so your patience is appreciated.
As part of an un-alterable constraint in my project, I must convert a Vector to an Array. In my searching for a solution I have repeatedly come across answers like this one.
As I understand, that solution gives you a pointer to the first element in the vector -- and since a vector is guaranteed to be contiguous in memory you can then set the array to point to that memory location (or something like that).
My question is, though, how exactly do I do that in C++? The answer seems to suggest it is trivial, but I can't find how to do it.
I have tried things of this nature but they don't work....
std::vector<double> v;
double* a = &v[0];
double myArray[100];
&myArray[0] = a;
Given a pointer to the first element in a sequence, how do I then use that pointer to 'populate' an array? Furthermore, do I have to worry about size differences/going out of bounds issues? Also, could I do this in reverse as well ('populate' a vector with a pointer to the first element of an array)?