Performs the appropriate comparison operation between the multimap containers lhs and rhs.

The equality comparison (operator==) is performed by first comparing sizes, and if they match, the elements are compared sequentially using operator==, stopping at the first mismatch (as if using algorithm equal).

The less-than comparison (operator<) behaves as if using algorithm lexicographical_compare, which compares the elements sequentially using operator< in a reciprocal manner (i.e., checking both a<b and b<a) and stopping at the first occurrence.

The other operations also use the operators == and < internally to compare the elements, behaving as if the following equivalent operations were performed:

operation

equivalent operation

a!=b

!(a==b)

a>b

b<a

a<=b

!(b<a)

a>=b

!(a<b)

Notice that none of these operations take into consideration the internal comparison object of neither container, but compare the elements (of type value_type) directly.

value_type is a pair type, and as such, by default, two elements will compare equal only if both their key and mapped value compare equal, and one compare lower than the other only if the first key is lower, or if the keys are equivalent and the mapped value is lower.

These operators are overloaded in header .

Parameters

lhs, rhs

multimap containers (to the left- and right-hand side of the operator, respectively), having both the same template parameters (Key, T, Compare and Alloc).

Return Value

Complexity

For (1) and (2), constant if the sizes of lhs and rhs differ, and up to linear in that size (equality comparisons) otherwise.
For the others, up to linear in the smaller size (each representing two comparisons with operator<).

Iterator validity

No changes.

Data races

Both containers, lhs and rhs, are accessed.
Up to all of their contained elements may be accessed.

Exception safety

If the type of the elements supports the appropriate operation with no-throw guarantee, the function never throws exceptions (no-throw guarantee).
In any case, the function cannot modify its arguments.