I've a class myClass that has a type defined in it, myType, and a static const std::map that uses this type. How must I initialise the member?
The situation is like this. The compiler tells me: multiple definition of MyClass::myMap. But there is really only one definition. Is the (schematically) initialisation correct?
class myClass
{
struct myType
{
// ...
}
static const std::map<int, myType> myMap;
};
const myClass::std::map<int, myType> myMap = {
{1, {"hello myType", 99, "woops"}},
{2, {"hello again", 66, "holla"}},
{3, {"and bye", 33, "adios"}},
};
Aucun commentaire:
Enregistrer un commentaire