Boost logo

Boost :

From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2008-05-18 00:28:30


On Friday 16 May 2008 22:01, Ronald Garcia wrote:
> 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;
> }
>

Couldn't you do a little better (half the number of overloads) by using
boost::unwrap_reference for the return type? For example,

template<typename F>
boost::unwrap_reference<F>::type&
unwrap(F &f)
{
        return f;
}

-- 
Frank



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