Multimap question: is find() guaranteed to return the first matching key
I'm trying to track down a problem in someone else's code. At one spot, find() is used on a multimap like so (i is an int):
My question is if this could be the source of the problem I'm trying to track down. More specifically, is this code guaranteed to iterate over all values in the multimap that have a key of i? In other words, is find() guaranteed to find the first value with i?
MyMultiMap::iterator matching = myMultimap.find( i );
while ( matching != myMultimap.end() && matching->first == i )
// do stuff
According to Schildt (STL Programming From the Ground Up), it is: "[The find() function] always returns an iterator to the first matching key" (page 172). But Meyers, in Effective STL (page 201), writes: "For the multi containers, however, find is not guaranteed to identify the first element in the container with a given value if more than one is present; its character is only to identify one of those elements."
I'm inclined to believe that Schildt is full of bullschildt, and that Meyers is correct, but could someone please confirm this? It's not that I'm worried that Schildt is right when Meyers is wrong (yeah, that'll happen!), I'm more worried that I'm interpreting Meyers wrongly and that find doesn't work with multimaps like I think it does. (One confusing thing is that Meyers uses the word "value" when I think he should be using "key".)