In C++ I have a vector_map of the form <string, std::vector<double>>. I need to change those vectors of doubles to arrays of doubles so that I get an array_map of the form <string, double[]>
The problem is that when doing so, the arrays for every element in the map are the same and their elements are different from those of the original vectors. What I have right now is this:
map<string, double*> array_map;
for (auto it : vector_map){
double temp_arr[size of it.second as a const];
std::copy(it.second.begin(), it.second.end(), temp_arr);
array_map.insert({it.first, temp_arr});
}