#include <functional> // less, function, bind
#include <list> // list
#include <string> // string
using namespace std;
template< class Type >
bool isLess( Type const&a, Type const& b )
{
return less< Type >()( a, b );
}
template< class Type, class Func >
bool isLess( Type const& a, Type const& b, Func const& f )
{
return isLess( f( a ), f( b ) );
}
template< class Type, class Func >
function< bool (*)( Type const&, Type const& ) > lessFunc( Func f )
{
return bind( isLess< Type, Func >, f );
}
size_t myConvertFunc( string const& s )
{
return s.length();
}
int main()
{
list<string> L;
L.sort( lessFunc< string >( myConvertFunc ) );
}