#include <string>
#include <map>
namespace myNamespace
{
struct MyStruct
{
static std::map<int, std::string> idNameMap;
// some other static properties
};
class MyClass
{
private:
void myMethod() {
std::map<int, std::string>& myMap = MyStruct::idNameMap; // C2062: type 'int' unexpected
for (auto& it : myMap)
{
// do some stuff with map values
}
}
};
}
I'm trying to reference the static map property in MyStruct
but it is producing this error. I'm not sure if more context is needed, but if so please let me know.