11
Classes
[class]
11.10
Comparisons
[class.compare]
11.10.4
Secondary comparison operators
[class.compare.secondary]
1
#
A
secondary comparison operator
is a relational operator (
[expr.
rel]
) or the
!
=
operator
.
A defaulted operator function (
[over.
binary]
) for a secondary comparison operator
@
shall have a declared return type
bool
.
2
#
The operator function with parameters
x
and
y
is defined as deleted if
(2.1)
overload resolution (
[over.
match]
), as applied to
x @ y
, does not result in a usable candidate, or
(2.2)
the candidate selected by overload resolution is not a rewritten candidate
.
Otherwise, the operator function yields
x @ y
.
The defaulted operator function is not considered as a candidate in the overload resolution for the
@
operator
.
3
#
[
Example
1
:
struct
HasNoLessThan
{
}
;
struct
C
{
friend
HasNoLessThan
operator
<
=
>
(
const
C
&
,
const
C
&
)
;
bool
operator
<
(
const
C
&
)
const
=
default
;
// OK, function is deleted
}
;
—
end example
]