
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