I want to initialize a std::map in my_cpp.h header file:
std::map<std::string, double> my_map;
my_map["name1"] = 0;
my_map["name2"] = 0;
But there was a compile error showed up:
error: ‘my_map’ does not name a type
Can someone explain why this not work for a C++ newbie? Thanks
std::map<std::string, double> my_map{{"name1", 0}, {"name2", 0}};