A
Alf P. Steinbach
* Old Wolf:
First point you're wrong, for the general case of _any_ type: there is no
requirement of a temporary in the standard. Quite the opposite. ;-) Second
point you're wrong, this code involves a 'double' rvalue, and there's no
such thing as a temporary non-class type rvalue. Third point you're wrong,
the notation with no arguments is not the cast notation described by
§5.2.3/1 and championed by Greg, which we were discussing, but the rvalue
creation notation described by §5.2.3/2, which is a very different beastie.
Yes, I would.
Here's another example:
double get() { return double(); }
The return statement creates a temporary double and then
returns it. No arguments here.
First point you're wrong, for the general case of _any_ type: there is no
requirement of a temporary in the standard. Quite the opposite. ;-) Second
point you're wrong, this code involves a 'double' rvalue, and there's no
such thing as a temporary non-class type rvalue. Third point you're wrong,
the notation with no arguments is not the cast notation described by
§5.2.3/1 and championed by Greg, which we were discussing, but the rvalue
creation notation described by §5.2.3/2, which is a very different beastie.
But you would say that the following does not create a
temporary double? :
double get() { return double(1); }
Yes, I would.