Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-07-15 15:28:34

Michael Goldshteyn:

> // This doesn't compile, however, even though the reference_wrapper class
> template has
> // an overloaded operator T& () const function
> std::string
> colorFromConstRef2(boost::bind(&Crayon::GetColor,_1)(crefCr));

It doesn't because of the mem_fn behavior that bind inherits. The argument
is not a reference to Crayon and so is assumed to be a smart pointer to
Crayon. mem_fn then tries to invoke get_pointer() on it to obtain a Crayon*.
You should be able to make it compile by adding a get_pointer overload for

namespace boost

template<class T> T* get_pointer( reference_wrapper<T> const & r )
    return r.get_pointer();


Boost list run by bdawes at, gregod at, cpdaniel at, john at