Boost logo

Boost :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2008-05-16 22:01:56


On May 16, 2008, at 6:33 PM, Peter Dimov wrote:

> Ronald Garcia:
>> Hi all,
>>
>> boost::reference_wrapper exists at the top-level of boost (in boost/
>> ref.hpp), but that header provides no way to unwrap a
>> reference_wrapper. There are two implementations floating around of
>> "unwrap", one in boost.bind's implementation details, and one in
>> boost.mpl's implementation details. Is there any problem with
>> providing a version of unwrap in ref.hpp?
>
> What is the specification of unwrap that you have in mind?

Something like the following:

template< typename F >
inline
F& unwrap(F& f)
{
     return f;
}

template< typename F >
inline
F&
unwrap(reference_wrapper<F>& f)
{
     return f;
}

template< typename F >
inline
F&
unwrap(reference_wrapper<F> const& f)
{
     return f;
}

The above is adapted from the mpl implementation.

ron


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