|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> Warp wrote:
> > 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.
> And that's precisely what the C# syntax avoids you having to do, in the
> other direction.
So instead of writing a function which takes two objects and returns
a bool, you write a "member function" which which called with one object,
takes another as parameter, and returns bool?
I'm still not seeing the huge difference.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |