|
Boost : |
Subject: Re: [boost] [Multiprecision] Does MP use references internally?
From: John Maddock (john_at_[hidden])
Date: 2013-06-21 07:56:53
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk