Boost logo

Boost :

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


On 1/27/10 7:45 AM, Joachim Faulhaber wrote:
> 2010/1/27 Eric MALENFANT <Eric.Malenfant_at_[hidden]>:
>> Joachim Faulhaber wrote:
>>> 2010/1/24 Grant Erickson <gerickson_at_[hidden]>:
>>>> The creasing algorithm templates define four template functions for
> [..]
>>>
>>> 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;
>>> }
>>>
>>
>> This looks a lot like the is_sorted algorithm from n3000:
>>
>>    template<class ForwardIterator, class Compare>
>>    bool is_sorted(ForwardIterator first, ForwardIterator last,
>>                   Compare comp);
>>
>>
>> which also includes is_sorted_until:
>>
>>    template<class ForwardIterator, class Compare>
>>    ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator
>> last,
>>                                    Compare comp);
>
> Thank you for this hint. I think this is what we need to express sortedness
> or orderedness.

Eric and Joachim:

Agreed that these completely satisfy the problem at hand. I also note that
boost currently has:

    boost/detail/algorithm.hpp

which contain variant implementations. What is the best process for getting
these "detail" implementations and/or N3000 proposals promoted into
full-fledged implementations in Boost?

Regards,

Grant


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