I am trying to use the erase method on a map as follows:
map <int,loan*> loanMap;
map <int,loan*>::iterator loanit;
for (loanit=loanMap.begin();loanit != loanMap.end();loanit++)
{
if ((*loanit).first==access)
{
loanMap.erase(access);
}
}
The loanMap.erase(access) code causes a memory access violation.
Please can you help?
Thanks
map <int,loan*> loanMap;
map <int,loan*>::iterator loanit;
for (loanit=loanMap.begin();loanit != loanMap.end();loanit++)
{
if ((*loanit).first==access)
{
loanMap.erase(access);
}
}
The loanMap.erase(access) code causes a memory access violation.
Please can you help?
Thanks