Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-15 12:19:01


Douglas Gregor <gregod_at_[hidden]> writes:

> On Sunday 15 December 2002 11:39 am, David Abrahams wrote:
>> I'm confused. Either you misunderstood my suggestion or you're seeing
>> some deeper problem that I've missed.
>
> For reference_wrapper to be Assignable, it has to hold a pointer to the object
> it references (if it holds a reference, like reference_to_value does, it
> wouldn't be Assignable).

Ouch, right.

> The probably is getting that pointer type. If T is not a reference, it's just
> T*. If T is a reference, we need
> typename remove_reference<T>::type*
>
> ... and remove_reference doesn't work on all compilers. Maybe there's another
> way to get a pointer type T* from a reference type T&?

Not a chance.

However, what about the ``~Self(); new((void*)this)(other);'' idiom?

We could store a reference and use that to reseat it.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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