Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-15 10:58:09


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

-- 
                       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