Boost logo

Boost :

Subject: Re: [boost] Review Request: Creasing (Sequence Properties)
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2010-01-27 10:45:01


2010/1/27 Eric MALENFANT <Eric.Malenfant_at_[hidden]>:
> Joachim Faulhaber wrote:
>> Hi Grant,
>>
>> 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.


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