Skip to main content
gamedev.net
🔒 Locked

Print data from map

Started by 3dmodelerguy Feb 21, 2005 at 7:43 PM 1 replies 500+ views
Original Post
3dmodelerguy
3dmodelerguy
Hey i have a map declare like this: std::map _config_data; i want to print out only the string's of the map, hwo can i do this?
Evil Steve
Evil Steve
The same way you do with any other STL structure. Iterate through it:
for(std::map<std::string, CConfigSection>::const_iterator it=_config_data.begin(); it!=_config_data.end() ++it){   cout << it->first;}

I think that code is correct, it's untested.
bkt
bkt
Looks good; although you might want to use pointers as the value in the map.
-John "bKT" Bellone [homepage] [[email=j.bellone@flipsidesoftware.com]email[/email]]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.