
Hi Grant, 2010/1/24 Grant Erickson <gerickson@nuovations.com>:
The creasing algorithm templates define four template functions for determining the order properties of sequences, specifically:
* Increasing * Decreasing * Strictly Increasing * Strictly Decreasing
in your implementation of 'creasing' you provide the four specific algorithms is_[strictly_]{in_,de_}creasing while hiding the general algorithm is_creasing in namespace detail. I'd suggest to implement only the latter. This would make your extension both more minimal and more general. template <typename ForwardIterator, typename BinaryPredicate> bool is_ordered(ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred) { return std::adjacent_find(first, last, std::not2(binary_pred)) == last; } Although 'creasing' undoubtedly is a very enjoyable word it violates the principle of least astonishment. So I'd prefer 'ordered'. Algorithm is_ordered can be used to express orderedness or sortedness for operators <, >, <= and >= but also can be used for arbitrary other strict or partial orderings. is_ordered(worlds.begin(), worlds.end(), more_perfect<world>()); is_ordered not only allows to use arbitrary ordering relations, you can also apply the algorithm to check, if elements of a sequence all share the same equivalence class, if binary_pred is an equivalence relation: is_ordered(people.begin(), people.end(), same_sex<person>()); Best, Joachim