12
Overloading
[over]
12.6
Overloaded operators
[over.oper]
12.6.1
Unary operators
[over.unary]
1
#
A
prefix unary operator function
is a function named
operator
@
for a prefix
unary-operator
@
(
[expr.unary.op]
) that is either a non-static member function (
[class.mfct]
) with no parameters or a non-member function with one parameter
.
For a
unary-expression
of the form
@
cast-expression
, the operator function is selected by overload resolution (
[over.match.oper]
)
.
If a member function is selected, the expression is interpreted as
cast-expression
.
operator
@
(
)
Otherwise, if a non-member function is selected, the expression is interpreted as
operator
@
(
cast-expression
)
[
Note
:
The operators
+
+
and
-
-
(
[expr.pre.incr]
) are described in
[over.inc]
. —
end note
]
2
#
The unary and binary forms of the same operator are considered to have the same name
.
[
Note
:
Consequently, a unary operator can hide a binary operator from an enclosing scope, and vice versa
.
—
end note
]