12
Overloading
[over]
12.4
Overloaded operators
[over.oper]
12.4.2
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 non-object 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
1
:
The operators
+
+
and
-
-
(
[expr.
pre.
incr]
) are described in
[over.
inc]
.
—
end note
]
2
#
[
Note
2
:
The unary and binary forms of the same operator have the same name
.
Consequently, a unary operator can hide a binary operator from an enclosing scope, and vice versa
.
—
end note
]