Why does this not work?
#include <iostream>
#include <map>
#include <vector>
int main() {
struct Point final {
Point(int xx, int yy)
: x {xx}
, y {yy}
{
}
int x {};
int y {};
};
static const std::vector<std::vector<Point>> points {
{{1,2}},
{{2,3}},
{{4,5}},
};
static const std::map<int, std::reference_wrapper<const std::vector<std::vector<Point>>>> mymap {
{0, points},
};
for (auto const& p : mymap[0][0]) {
std::cout << p.x << "\n";
std::cout << p.y << "\n";
}
return 0;
}
passing 'const std::map<int, std::reference_wrapper<const std::vector<std::vector<main()::Point> > > >' as 'this' argument discards qualifiers [-fpermissive]