M
Markus Dehmann
I have a class Foo that contains a map<string,string> internally. Now,
I want that users can iterate over the entries in the map. What's the
best way to do that?
I tried a method like
map<string,string>::const_iterator get_const_iterator(){
return my_map.begin();
}
but then users also need to know where the end() of the map is in
order to for-loop over the elements.
So, do I have to provide a begin() and end() method in my Foo class?
Or is there a better solution?
Thanks
Markus
I want that users can iterate over the entries in the map. What's the
best way to do that?
I tried a method like
map<string,string>::const_iterator get_const_iterator(){
return my_map.begin();
}
but then users also need to know where the end() of the map is in
order to for-loop over the elements.
So, do I have to provide a begin() and end() method in my Foo class?
Or is there a better solution?
Thanks
Markus