Boost logo

Boost :

From: Rani Sharoni (rani_sharoni_at_[hidden])
Date: 2004-02-07 05:59:07


David Abrahams wrote:
>> The example below shows a technique for perfect forwarding that seems
>> to work with GCC 3.3.1. rvalues are always moved automatically, and
>> lvalues are copied.
>> [...]
>> may have missed something. *If* my example actually works other than
>> this case, I'd like to try to get the rule lifted, and soon! This is
>> by no means the cleanest route to move semantics, but it's probably
>> the smallest "language extension" we'd ever need to get it, and might
>> even be possible before C++0x

I already mentioned during the improved auto_ptr discussions that I'm not
smart enough to use the new trick in order to introduce move semantics. It
seems that you amazingly did it!

>> Except for one rather important case, it works with Comeau (errors
>> only in strict mode). The important case that causes the error
>> clearly violates 12.2/1 of the standard, but see below.

The problem with reference binding using conversion
operator/constructor(i.e. X const& r = X()) is addressed in active DR #291
(see Mr. Adamczyk note) and AFAICT it was discussed during the MoJo days.

IMHO the current standard explicitly allows it (per 8.5.3/5/2/1) and EDG is
not very consistent about it:

auto_ptr<Base> const& r = auto_ptr<Derived>(); // accepted by EDG

auto_ptr<Base> const& r = auto_ptr<Base>(); // rejected by EDG

Thank you,

Rani


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk