I think I stated that. For lists, unless the element that the iterator is referring to is erased, iterators are still valid, regardless of any modifications done to the list.Quote:
Originally Posted by SuperKoko
Regards,
Paul McKenzie
Printable View
I think I stated that. For lists, unless the element that the iterator is referring to is erased, iterators are still valid, regardless of any modifications done to the list.Quote:
Originally Posted by SuperKoko
Regards,
Paul McKenzie
Why do you need a nested map? According to what you asked for - what SuperKoko/I suggested would do the job!
Anyways, iteration would look something like this:
You may also use algorithms to help you ease with this as needed. Pushing elements into a map should be easy - if you are able to deal with simple map<string, string> then I am sure you can deal with map<string, map>. Or let us know your code and what is the exact thing that you are finding difficult to express in code. Regards.Code:#include<map>
#include<string>
using namespace std;
int main()
{
map<string, map<string, string> > myMapOfMaps;
for(map<string, map<string, string> >::const_iterator it = myMapOfMaps.begin();it!=myMapOfMaps.end();++it)
{
for(map<string, string>::const_iterator itInternal = (it->second).begin(); itInternal!=(it->second).end(); ++itInternal)
{
//do something
}
}
}
When you guys told me that it is possible to have nested containers, you solved two of my problems. So the nested map was another problem.
Anyhow, thank you.