I have experienced some difficulty with sorting lists of type:
list < shared_ptr < foo > >
> [snip] >
> [snip]bool my_class::operator<(const my_class& arg) { return m_val < arg.m_val; }
//sort the list my_list.sort();
Here, you basically sort by using
shared_ptr::operator<
instead of
my_class::operator<
You need something like
template< T > struct shared_ptr_content_less { bool operator()( const boost::shared_ptr< T >& lhs, const boost::shared_ptr< T >& rhs ) const { return *lhs < *rhs; } };
and call
my_list.sort( shared_ptr_content_less< my_list >() );
The code is untested, but I hope you get the idea. Also, there might be some easier way using other boost-libs to create the helper on-the-fly, but others definitely know better than me :)
Regards, Daniel
-- Daniel Frey
aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: [EMAIL PROTECTED], web: http://www.aixigo.de
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost