Given that prefix unary operators can be "implemented by a non-static member function with no parameters or a non-member function with one parameter" (§13.5.1[over.unary]/1), is there a difference besides the usual encapsulation/code reuse design rationales that apply to any member/non-member function choices?
For binary operators, there's a semantic difference because non-members allow implicit conversions of their left-hand operands. There doesn't seem to be anything like that for the unary operators, yet the standard defines std::complex
's unary negation operator as a non-member (§26.4.6[complex.ops]), while std::valarray
's and std::duration
's unary negation operators are members (§26.6.2.6[valarray.unary], §20.11.5.3[time.duration.arithmetic]). Is there a nuance?