how do i initialize a class' private member static map whose value is a struct?
c++, data-structures, dictionary, static
Solution
With this line:
map<string, Devices::DevicePair> Devices::m_SYSdeviceMap;
Also, as a good coding practice, remove the `using namespace std;` from your header, and qualify your use of map - `std::map`.
Problem
I have a class whose private member is a static map: ``` Class Devices { ... private: struct DevicePair { int nCtr; bool isToAdd; }; DevicePair m_DevPair; static map <string, DevicePair> m_SYSdeviceMap; }; ``` Why can't I just do this in the cpp file? ``` map <string, DevicePair> Devices::m_SYSdeviceMap; ``` How do I initialize this in the cpp file?