C++ - Vector initialization failing
-
08-06-2021 - |
Question
I'm attempting to initialize a multi-dimensional vector with:
vector<double> v0(point_list.size(), numeric_limits<double>::max);
vector<vector<double> > v1(point_list.size(),v0);
Unfortunately, I'm getting the error:
error: no matching function for call to ‘std::vector<double>::vector(std::vector<std::vector<int> >::size_type, double (&)()throw ())’
Can anyone explain this to me and how to fix it?
Thanks!
La solution
numeric_limits<double>::max
is a function. You wanted to say:
vector<double> v0(point_list.size(), numeric_limits<double>::max());
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow