P
puzzlecracker
Will the array be deallocated and if so, what is a workaround?
double * GetArrayFromVector( std::map m, char ** names, int count )
{ if(!names) return 0;
vector<double> vec(m.size());
for (int i=0; i<count; ++i)
{
if(!names) return 0;
map<std::string, double>::iterator iter=m.find(name);
if(iter!=m.end())
vec.push_back(iter->second);
else
return 0;
}
return &vec[0];
}
Thanks a lot
double * GetArrayFromVector( std::map m, char ** names, int count )
{ if(!names) return 0;
vector<double> vec(m.size());
for (int i=0; i<count; ++i)
{
if(!names) return 0;
map<std::string, double>::iterator iter=m.find(name);
if(iter!=m.end())
vec.push_back(iter->second);
else
return 0;
}
return &vec[0];
}
Thanks a lot