
I try to define a "sortby" method that would sort a list using any member function that fits some constraints (taking no parms, returning a result that can be compared using the > operator and being const) I wrote this: template <class T> class mylist:public std::list<T> { // ... template <typename T2, typename R, R (T2::*F)() const> struct cmp: public std::binary_function<T,T,bool> { bool operator()(const T& f1, const T& f2) {return (f1.F)() > (f2.F)();}; }; template <typename T2, typename R> bool sortby(R (T2::*F)() const) { sort(cmp<T,R,F>()); return true; }; }; // class mylist using VC6 (I know...) I get these 3 errors: algos.h(356) : error C2440: 'specialization' : cannot convert from 'double (__thiscall cadoo::cadFace::*)(void) const' to 'double (__thiscall cadoo::cadFace::*)(void)' algos.h(356) : error C2975: 'cmp' : invalid template argument for 'F', constant expression expected algos.h(356) : error C2514: 'dyl::List<class cadoo::cadFace>::cmp<class cadoo::cadFace,double,0>' : class has no constructors any idea ? I also checked boost.org for help on functors, lambda ... but could not figure out how to use them simply for my application. thanks! Philippe Guglielmetti