22 Nov
2005
22 Nov
'05
1:11 a.m.
Mark Santaniello (AMD) wrote:
template< typename T > boost::function
foo( T n_ ) { //Works, but leaks n //T *n = new T( n_ ); //Doesn't work boost::shared_ptr<T> n( new T(n_) );
return ( *n += _1 );
I think that you need to wrap n in boost::lambda::constant: return *constant(n) += _1; Without it, *n is evaluated immediately.
}