
AMDG David Sankel wrote:
This works:
const boost::function< void( T const * const) > f = bind( &TVec::push_back, &tVec, bind( constructor<TPtr>(), bind( &T::clone, _1)));
But this doesn't:
const boost::function< void( const T & ) > g = bind( &TVec::push_back, &tVec, bind( constructor<TPtr>(), bind( &T::clone, boost::cref(_1) )));
The compilation error I'm getting is that it cannot create a new object of type T and that is expected since T is abstract. Why would lambda be making copies instead of passing on the reference?
I've attached a simplified version of the problem.
There is no need to wrap _1 in cref. Boost.Lambda will pass the arguments by reference anyway. In Christ, Steven Watanabe