NewToCPP wrote:
OOPS... incomplete question..
If no match is found for the key, end( ) is returned
I can check if the returned item == m1.end( ) ). If so, item not
found.. otherwise use the returned value...
Is there any other way to find out that the item with the given key is
not found???
There are other ways, but they all end up at around about the same
place AFAICS... IOW the end(). std::map is meant to be a black box, but
it is usually implemented as a tree. The map sorts all the ids so that
it can find them fast, hence using find() is likely to be the fastest
and best method of finding things in the map..or not as the case may
be. The iterators are usually only useful to enumerate through the map
to see whats in there
hmm .. I love std::map :-)
regards
Andy Little