Boost logo

Boost :

Subject: Re: [boost] Review Request: Creasing (Sequence Properties)
From: Grant Erickson (gerickson_at_[hidden])
Date: 2010-01-27 19:13:37


On 1/27/10 1:11 PM, Joachim Faulhaber wrote:
> 2010/1/27 Simonson, Lucanus J <lucanus.j.simonson_at_[hidden]>
>> Joachim Faulhaber wrote:
>>> 2010/1/24 Grant Erickson <gerickson_at_[hidden]>:
>>>> 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.
>>>
> [..]
>> Nobody is at a loss as to how to code up something to figure out whether
>> elements in an iterator range are sorted, and nobody would or even
>> should look in boost for such a simple thing.
>
> 'is_sorted' is an important predicate. But it lives as an invariant
> to be maintained rather than a function to computed. So we have
> happily coded all kinds of sorted things without explicitly using
> and not necessarily needing it.
>
> My question: Other than inside BOOST_ASSERTS, where do we really
> need is_sorted in production code. Are there convincing use cases?

Yes, my original post contained what I thought to be a very valid use case.
See:

    http://lists.boost.org/Archives/boost/2010/01/161121.php

Basically, I see as useful anywhere sorted inputs are demanded where it is
not possible or warrant to copy and then sort the inputs on behalf of the
caller.

At this point, as I mentioned a few posts back, I am happy with the
is_sorted template discovered in boost/detail/algorithm.hpp and would love
to see it and the N3000 proposal promoted to boost/algorithm/sorted.hpp as a
first-class template citizen and rescind my review proposal/request if
there's support and interest in that approach.

Regards,

Grant


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk