I’m trying to iterator through a map object using the following chunk of code:
for(map<int, vector>::iterator table_iter = table.being(); table_iter != table.end(); table_iter++)
{
...
}
And I keep getting errors telling me:
conversion from const_iterator to non-scalar type iterator requested
And I can’t seem to determine why the iterator would be const vs. not-const, or how to deal with this.
Use
map<int, vector>::const_iteratorinstead which is returned bymap::begin.