Boost logo

Boost :

Subject: Re: [boost] [ref] provide unref( T& )?
From: Daniel Wallin (daniel_at_[hidden])
Date: 2008-12-11 05:52:05


Thorsten Ottosen wrote:
> Hi,
>
> To be able to call a function object wrapped in
> boost::reference_wrapper<T>, we need something like the following:
>
> template< class T >
> inline typename boost::unwrap_reference<T>::type&
> unref( T& value )
> {
> return static_cast<typename
> boost::unwrap_reference<Fun>::type&>(value);
> }
>
> which can then be used like
>
>
> template< class Fun >
> int algorithm( Fun fun )
> {
> return unref(fun)(42);
> }
>
> any objections to adding this to ref.hpp?

There's already unwrap_ref() which does exactly this. It doesn't seem to
be documented though.

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

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