From: Pavol Droba (droba_at_[hidden])
Date: 2003-10-29 11:14:08
On Wed, Oct 29, 2003 at 10:17:55AM -0500, Rob Stewart wrote:
> I couldn't disagree more. Were I reviewing that code without
> knowing a priori that find_nth() used zero-based numbering, I'd
> flag that as an error. The *name* find_nth() invokes ordinals
> and there's no 0th. One poster suggested that the year before
> one's first birthday, is the 0th year. Sorry, but I've never
> heard anyone mention the 0th year of a child's life.
There is always quite a big difference between human language
and formal/scientific definitions.
1st year is actualy something between 0 and 0.9999... so it has
naturaly the index 0.
> If you change "nth" in "find_nth" to something else, or rename
> the function altogether, we avoid the confusion.
Actualy, I don't know about any native C/C++ entity which has 1-based
indexing, so does not have to be so unnatural as it seems.
I have updated docs with explicit note, that the index is 0-based.
To improve the naming, I can change the name of paramter from "nth" to "index".
This way the "find_nth" function will search for an n-th occurence of the
matching string, referenced by an "index".
Would this make this matter more clear?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk