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?
With this line:
Also, as a good coding practice, remove the
using namespace std;from your header, and qualify your use of map –std::map.