Darren New wrote:
> In C++ you call
> qsort(myArray, operator< );
> or some such syntax, but without the need to have a specifically named
> function just to wrap up the < operator.
std::sort(myArray) is all you need. Guess *how* the operator< is used by
default?
template <typename T> bool less(const T& x, const T& y) {
return x < y;
}
std::sort uses std::less as the default sorting function.
Post a reply to this message
|