Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-12-15 11:22:21


On Sunday 15 December 2002 10:58 am, David Abrahams wrote:
> I just noticed I have the following in
> boost/python/object/forward.hpp:
>
> // Very much like boost::reference_wrapper<T>, except that in this
> // case T can be a reference already without causing a
> // reference-to-reference error.
> template <class T>
> struct reference_to_value
> {
> typedef typename add_reference<typename add_const<T>::type>::type
> reference;
>
> reference_to_value(reference x) : m_value(x) {}
> operator reference() const { return m_value; }
> private:
> reference m_value;
> };
>
> It strikes me that I might be able to replace this with
> reference_wrapper if it just did the same little add_reference<T>
> trick itself (I can handle the const externally). If you look further
> down in that file you'll see there's now logic for unwrapping
> something which might either be reference_wrapper _or_
> reference_to_value, so it could be a major win.
>
> Any thoughts/objections/whatever?
>
> -Dave

Good idea so long as reference_wrapper stays Assignable. Is remove_reference
implemented on all compilers? If so, I have no objections.

        Doug


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