Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] is_ordered name
From: Christopher Jefferson (chris_at_[hidden])
Date: 2011-09-23 20:43:01


On 24 Sep 2011, at 01:08, Phil Endecott wrote:

> Marshall Clow <mclow.lists_at_[hidden]> wrote:
>> On Sep 23, 2011, at 9:33 AM, Phil Endecott wrote:
>>> 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)) { ... }".)
>>
>> "disorder" doesn't sit quite right with me for some reason.
>>
>> How about "ordered_until", maybe?
>>
>> or "find_unordered"
>
> Well, I have a find_ordered that does a binary search on a sorted range like std::up|lower_bound and std::equal_range do. I have always felt that std::find should be called std::find_unordered, or at least something in the name should indicate which of those std::algorithms require an ordered range and which don't. Anyway, find_unordered sounds to me like a variant of std::find, which is not what this algorithm is. I think any find_ADJECTIVE would sound like that to me; this case needs a find_NOUN.
>
> I spent a few moments trying to think of a noun that means "point at which ordering stops". There probably is one that's better than "disorder". It's not quite a "discontinuity", but maybe there is something like that from maths. I also wondered about a more general word like "failure", since any predicate can be passed. "find_ordering_failure" maybe? Or even just "find_unordering" or "find_unorder". Any thoughts?

I think the C++ standard uses find_first in a few places, so:

find_first_unordered?

Getting quite long I realise.

Chris


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