简体   繁体   中英

C++ - Vector initialization failing

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!

numeric_limits<double>::max is a function. You wanted to say:

vector<double> v0(point_list.size(), numeric_limits<double>::max());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM