Hey folks, I have a problem regarding using std::list::sort. I wrote my own comparator function below, and called sort with said function as the input parameter. I don't understand why the compiler cannot find the function when it seems to me that nothing's wrong. Help would be appreciated. Thanks.
Your Driver::compareDist<> is a member function (template). Member functions cannot be used with algorithms.
Your best bet is to make it a function object that takes sortOrder as a constructor argument (or, alternatively, use bind() to convert your existing member function to such object)
Heh, I guess putting this in the beginners subforum was the right place after all. I took a look at the documentation for functors(never used them before, haven't been taught anything about them yet) online but I'm not quite sure how to use them in this case. Could you kindly provide an example?