Template:cpp/container/operator cmp

Compares the contents of two s.

@1-2@ Checks if the contents of and  are equal, that is, they have the same number of elements and each element in  compares equal with the element in  at the same position.

@3-6@ Compares the contents of and  lexicographically. The comparison is performed by a function equivalent to std.

@7@ Compares the contents of and  lexicographically. The comparison is performed as if by calling std on two s with a function object performing synthesized three-way comparison (see below). The return type is same as the result type of synthesized three-way comparison. Given two lvalues  and  as left hand operand and right hand operand respectively (where  is ), synthesized three-way comparison is defined as:
 * if is satisfied, equivalent to ;
 * otherwise, if comparing two lvalues by  is well-formed and the result type satisfies , equivalent to

The behavior of is undefined if  or  is satisfied but not modeled, or  is used but  and  do not establish a total order.
 * otherwise, synthesized three-way comparison is not defined, and does not participate in overload resolution.

Return value
@1@ if the contents of the s are equal,  otherwise

@2@ if the contents of the s are not equal,  otherwise

@3@ if the contents of the  are lexicographically less than the contents of,  otherwise

@4@ if the contents of the  are lexicographically less than or equal to the contents of,  otherwise

@5@ if the contents of the  are lexicographically greater than the contents of,  otherwise

@6@ if the contents of the  are lexicographically greater than or equal to the contents of,  otherwise

@7@ The relative order of the first pair of non-equivalent elements in and  if there are such elements,  otherwise.

Example
{{#switch: {{{1}}}
 * vector=

Defect reports
}}