Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-06-20 12:52:38


At 08:22 AM 6/20/2001, Peter Dimov wrote:

>> I used 1 indexing in Felix, but just changed it to 0 based.
>> A tuple of elements of the same type is an array.
>> The convention in mathematics is 1 origin, in C it is 0 origin.
>> I personally prefer 1 origin, but I also dislike inconsistencies.
>
>When you consider 'tuple' on its own, zero-based indexing is more
>consistent; but when you make the next step to
>
>bind(f, _1, _2);
>
>and
>
>_1 + _2
>
>(replace _N with freeN according to taste :-) )
>
>one-based indexing is much more intuitive.

My memory of past discussions in the C++ committee was a strong preference
for consistent 0 based indexing even in the cases where it is less
intuitive.

I seem to remember someone saying something like "0 based indexing is just
one of the things you have to learn initially, and then it becomes second
nature." Heads nodded.

I'd say the advantage of any 1-based scheme would have to be totally
overwhelming before it would be worth deviating from such long standing
practice.

(Just a personal opinion.)

--Beman


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