
Boost : 
Subject: [boost] [Review:Algorithms] is_ordered behaviour for singleton input, and name
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 20110923 12:33:01
Dear All,
The docs for the proposed is_ordered say:
The function is_ordered(sequence, predicate) returns the point
in the sequence where the predicate does not hold. It does that
by comparing adjacent pairs of elements in the sequence to see if
the predicate is satisfied. If all adjacent pairs satisfy the
predicate, then it will return one past the last element of the
sequence.
OK.
If the sequence has less than two elements, it returns
the last element of the sequence. In other words, sequences of
length zero and one are considered to be ordered  using any
possible criteria.
Shouldn't that say "it returns one past the last element"?
Also, regarding the name: I would expect any "is_something" function to
return a boolean. Since this returns an iterator I would have called
it something like find_disorder. (There is a good chance that an
iterator is convertible to bool, so one could mistakenly write "if
(is_ordered(begin,end)) { ... }".)
Regards, Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk