I'm trying to make a class constructor that will take an initializer list and init a map with it like this:
class Test {
std::map<int, int> m_ints;
public:
Test(std::initializer_list<std::pair<int, int>> init):
m_ints(init)
{}
};
But that results in a very long error message which I frankly don't understand. What do I need to change to make this work?
See Question&Answers more detail:os