
21 Jun
2013
21 Jun
'13
11:56 a.m.
Nearly all operators, besides assigning and dereferencing ones, are supposed to return by value. Changing that, even with the “innocuous” (unary)+, is surprising.
This came up in review actually with no good solution - the main issue (apart from no one ever using unary + anyway) is that pretty much every numeric-class type ever written has done it that way. However... in the C++11 world I can think of one legitimate use case that's broken by this - and that's when you have user-defined literals: auto x = +1234_my_suffix; which results in a dangling-reference-to-temporary. So I'll change this shortly, Regards, John.