I want to initialize a std::vector (of std::pair), with k
objects, with the pair of values shown below.
Here is my attempt:
// int k
std
You can just switch to {
}
around the constructor arguments...
std::vector<std::pair<Point::FT, int>> v{k, {std::numeric_limits<FT>::max(), -1}};
See it running here
Assuming Point::FT
is something for which numeric_limits::max()
is valid,
std::vector <std::pair<Point::FT, int>>
v(k, std::make_pair(std::numeric_limits<FT>::max(), -1));