Accessing and assigning values in MAP, C++

Hi, I am using C++ to model traffic simulation on Linux platform. I am trying to read data from map object and assigning data..attached is the relevant code

typedef std::vector<double> vDouble;
typedef std::map<int,vDouble> mpInt2Double;
std::map<std::string*, mpInt2Double> mpCache;

for(map<int, string>::iterator pTables = m_pCoordinator->m_LOStime2name.begin();
pTables != m_pCoordinator->m_LOStime2name.end();
pTables++)
// for each los table ....
{
string strTable;
if(mpCache[strTable] == NULL)
{

mpCache[strTable] = new mpInt2Double;
}
}

It gives compilation error as
no match for ‘operator[]’ in ‘((CZoneCache*)this)->CZoneCache::mpCache[strTable]’

Can anyone help me out?

Thanks in advance

std::map<std::string*, mpInt2Double> mpCache;

mpCache[strTable] == new mpInt2Double;

let me tell you the truth:

1. the key of mpCache you defined is string pointer type, but your input is string type.
2. the value of mpCache you defined is mpInt2Double type, but your assignment is it's pointer type.

you got that?
when i removed the pointed part..it gave a an error like
error: no match for ‘operator==’ in ‘((CZoneCache*)this)->CZoneCache::mpCache.std::map<_Key, _Tp, _Compare, _Alloc>::operator[] [with _Key = std::basic_string<char>, _Tp = std::map<int, std::vector<double> >, _Compare = std::less<std::basic_string<char> >, _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::vector<double> > > >, mapped_type = std::map<int, std::vector<double> >, key_type = std::basic_string<char>](((const std::map<std::basic_string<char>, std::map<int, std::vector<double> > >::key_type&)((const std::map<std::basic_string<char>, std::map<int, std::vector<double> > >::key_type*)(& strTable)))) == 0l’
Topic archived. No new replies allowed.