Micheal Smith wrote:
On 2008-10-20 13:43:58 -0500, Victor Bazarov <v.********@comAcast.net>
said:
>Micheal Smith wrote:
>>I'm looking for a good method to convert a map::iterator to a
std::string. I've tried googling for a while, but haven't come up
with much. Perhaps I'm kludging things here. Either way any advice
would be greatly appreciated.
What are you hoping to get from the conversion?
V
I have a member function that searches a map for a key. The value tied
to the given key should be a std::string. It just seemed like a better
idea to return the original std::string, than simply an iterator.
Your original post is very poorly written. You are asking in your
original post how to *convert* a map::iterator (what kind of map?) into
a std::string. What does that even mean? Are you trying to generate a
string from the value of the iterator? Are you trying to cast the
iterator into a string? What?
Seemingly what you have is a std::map<something, std::string>, and you
have an iterator pointing to an element of this map, and you want to
dereference the string at that position in the map (which happens with
"yourIterator->second", which is probably the answer you are looking for).
You should be much more specific when you ask such questions.