Surya Kiran Gullapalli wrote:
The best way should be to use bind (or am i wrong here ?) from Boost library.
But i'm not getting the syntax correctly here.
the crude way could be
*stable_sort (files.begin(), files.end(), (bind (&File::get_size, _1) > bind (&File::get_size, _2))) ;*
that is call get_size() on first argument, and call get_size() on second argument, and compare those values, and return a boolean value.
Can anybody please help me out with the syntax here. ??
Right syntax, wrong library. You can do this with Boost.Lamba. http://www.boost.org/doc/html/lambda.html You might also want to look at phoenix. http://www.boost.org/libs/spirit/phoenix/index.html By the way, the accessor functions in your File class need to be const for this to work. Daniel