If you want to dynamically allocate it, do:
Code:
map<CString,double>* m_pMap;
m_pMap = new map<CString,double>();
If you want to allocate a map on the stack, or globally, do:
Code:
map<CString,double> theMap;
To insert into the map:
Code:
double value = 2.0;
(*m_pMap)[CString("Key")] = value;
To remove from the map:
Code:
m_pMap->erase(CString("Key"));
To determine if there is a particular entry in the map, do:
Code:
if (m_pMap->find(CString("Key")) != m_pMap->end()) {
// entry found
}
To iterate through all elements in the map, do:
Code:
map<CString,double>::iterator itr = m_pMap->begin();
map<CString,double>::iterator end = m_pMap->end();
for (; itr != end; itr++) {
cout << "Key: " << itr->first() << endl;
cout << "Value: " << itr->second() << endl;
}
That should be a start for you...