|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-30 12:42:54
Rob Stewart wrote:
> From: Daniel Spangenberg
>> Rob Stewart schrieb:
>>
>>> Because s[0] isn't the 0th element; it's the first. As I said,
>>> we use ordinals to refer to things like this. Addressing an
>>> element uses an index, and indexes start at zero. "nth"
>>> explicitly refers to ordinals, and there's no 0th; you start with
>>> 1st, so find_nth() should reasonably start numbering from one.
>>>
>>>> You can think of find_nth as indexing into a view onto the matching
>>>> substrings of s if you want.
>>
>> You you are right, but 0th is consistent to the naming of the std
>> algorithm nth_element.
>
> I don't agree with std::nth_element() taking zero to mean first,
> but it's in the Standard. That makes it a solid precedent.
Have you looked at the signature of std::nth_element? ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk