For a unary operator
@
with an operand of type
cv1 T1,
and for a binary operator
@
with a left operand of type
cv1 T1
and a right operand of type
cv2 T2,
four sets of candidate functions, designated
member candidates,
non-member candidates,
built-in candidates,
and
rewritten candidates,
are constructed as follows:
If
T1 is a complete class type or a class currently being defined,
the set of member candidates is the result of a search for
operator@ in the scope of
T1;
otherwise, the set of member candidates is empty
.For the operators
=,
[], or
->,
the set of non-member candidates is empty;
otherwise, it includes the result of unqualified lookup for
operator@
in the rewritten function call (
[basic.lookup.unqual],
[basic.lookup.argdep]),
ignoring all member functions
. However, if no operand has a class type, only those non-member
functions in the lookup set that have a first parameter of type
T1
or βreference to
cv T1β,
when
T1
is an enumeration type,
or (if there is a right operand) a second parameter of type
T2
or βreference to
cv T2β,
when
T2
is an enumeration type,
are candidate functions
.For the operator
,,
the unary operator
&,
or the operator
->,
the built-in candidates set is empty
. For all other operators, the built-in candidates include all
of the candidate operator functions defined in
[over.built] that,
compared to the given operator,
- have the same operator name, and
- accept the same number of operands, and
- accept operand types to which the given operand or
operands can be converted according to [over.best.ics], and
- do not have the same parameter-type-list as any non-member candidate
that is not a function template specialization.
The rewritten candidate set is determined as follows:
For the relational (
[expr.rel]) operators,
the rewritten candidates include
all non-rewritten candidates
for the expression
x <=> y.For the
relational (
[expr.rel]) and
three-way comparison (
[expr.spaceship])
operators,
the rewritten candidates also include
a synthesized candidate,
with the order of the two parameters reversed,
for each non-rewritten candidate
for the expression
y <=> x.For the
!= operator (
[expr.eq]),
the rewritten candidates
include all non-rewritten candidates
for the expression
x == y.For the equality operators,
the rewritten candidates also include a synthesized candidate,
with the order of the two parameters reversed,
for each non-rewritten candidate
for the expression
y == x.For all other operators, the rewritten candidate set is empty
.
[
Note 2:
A candidate synthesized from a member candidate has its
object parameter as the second parameter, thus implicit conversions
are considered for the first, but not for the second, parameter
. β
end note]