[over.unary]

# 12 Overloading [[over]](./#over)

## 12.4 Overloaded operators [[over.oper]](over.oper#over.unary)

### 12.4.2 Unary operators [over.unary]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L3491)

A [*prefix unary operator function*](#def:operator_function,prefix_unary "12.4.2 Unary operators [over.unary]") is a function named operator@ for a prefix [*unary-operator*](expr.unary.general#nt:unary-operator "7.6.2.1 General [expr.unary.general]") @ ([[expr.unary.op]](expr.unary.op "7.6.2.2 Unary operators"))
that is either
a non-static member function ([[class.mfct]](class.mfct "11.4.2 Member functions")) with no non-object parameters or
a non-member function with one parameter[.](#1.sentence-1)

For a [*unary-expression*](expr.unary.general#nt:unary-expression "7.6.2.1 General [expr.unary.general]") of the form @ [*cast-expression*](expr.cast#nt:cast-expression "7.6.3 Explicit type conversion (cast notation) [expr.cast]"),
the operator function is selected by overload resolution ([[over.match.oper]](over.match.oper "12.2.2.3 Operators in expressions"))[.](#1.sentence-2)

If a member function is selected,
the expression is interpreted as

[*cast-expression*](expr.cast#nt:cast-expression "7.6.3 Explicit type conversion (cast notation) [expr.cast]") . operator @ ()

Otherwise, if a non-member function is selected,
the expression is interpreted as

operator @ ( [*cast-expression*](expr.cast#nt:cast-expression "7.6.3 Explicit type conversion (cast notation) [expr.cast]") )

[*Note [1](#note-1)*:

The operators ++ and -- ([[expr.pre.incr]](expr.pre.incr "7.6.2.3 Increment and decrement"))
are described in [[over.inc]](over.inc "12.4.7 Increment and decrement")[.](#1.sentence-3)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L3517)

[*Note [2](#note-2)*:

The unary and binary forms of the same operator have the same name[.](#2.sentence-1)

Consequently, a unary operator can hide a binary
operator from an enclosing scope, and vice versa[.](#2.sentence-2)

â *end note*]
