On 09/16/2011 10:36 PM, Andrei Alexandrescu wrote:
On 9/16/11 3:16 PM, Timon Gehr wrote:
On 09/16/2011 09:12 PM, Andrei Alexandrescu wrote:
On 9/16/11 1:24 PM, Simen Kjaeraas wrote:
On Thu, 15 Sep 2011 19:14:24 +0200, Jonathan M Davis
I think that that's up for debate. I would fully expect a min/max
function to
be using a comparator function, which means using a binary predicate.

This seems weird to me. min already has a binary predicate - a < b.
This predicate is what defines min, any other predicate would make it
a different function - usually reduce, unless we're talking about
argMin (does argReduce make any kind of sense?).

That said, there are cases where a < b is not enough, owing to some
types not having a nice and simple comparison. Hence, binary
predicates should also be allowed. I just feel that in the general
case, binary predicates dilute the meaning of min/max. Would you
consider this code good?
min!"a > b"(range);
That's not min, that's max. More:
min!"a.member1 < b.member2"(range);
Again, it's not min, it's something else.

This is a good argument. The "something else" is "extremum"

The "something else" is a "least element of a total order"

Nope, because not the entire set is presented for the computation.

Andrei

The range defines the entire set we are looking at. What is your point?

Reply via email to