Boost logo

Boost :

From: Ross MacGregor (ross__macgregor_at_[hidden])
Date: 2003-10-28 16:22:03


Rob Stewart wrote:

> From: David Abrahams <dave_at_[hidden]>
>
>>I don't get it. The first element of a sequence is s[0]. Why
>>shouldn't the first matching substring be find_nth(s, XX, 0)?
>
> 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.

Yes agree with Rob on this one. I have been using 0 based indexes for a
long long time, but when i see find_nth(), I expect 1 to be the first
occurence.

I think in this case naming guidlines should override convention or
usage concerns. If you use a term like "nth" in the name, it should
reflect its usage in the english language.

-- 
Ross MacGregor

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