Darren New <dne### [at] san rr com> wrote:
> Yep. And now what do you do if the "less" you want to use is actually a
> member function of type T? What if the "less" you want to use is
> class MyDate {
> bool comesBefore(const MyDate& otherDate);
> }
You create a comparator and give that to std::sort. A comparator can be,
for example, a (regular) function which takes two elements and returns bool.
--
- Warp
Post a reply to this message
|