V
Victor Bazarov
Anand said:What is the neatest way to find the next element in a multimap or
multiset whose key is different from the current element?
E.g., if I have a multi set whose elements are like so:
1.0, 1.0, 1.0, 2.0, 3.0
and I am at the beginning (0th element). How do I get to the 3rd
element?
I suppose I could write a functor that implements the negation of the
multiset's predicate/comparator and call find_if, but I think there
should be a better way (like a member function on the container).
'std::equal_range' returns a pair of iterators. If the second one is
not 'end', it will point to the element that isn't in range. RTFM on
'equal_range'.
HTH
V