Boost logo

Boost :

Subject: [boost] [ref] provide unref( T& )?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-12-11 05:18:04


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?

-Thorsten


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