Boost logo

Boost :

From: jaakko.jarvi_at_[hidden]
Date: 2001-06-20 05:48:14


One minor point for 1 based indexing is, that
if the programmer has got the base wrong,
get<0>(t) fails at compile time, whereas in 0 based
indexing get<1>(t) probably wont.

Jaakko

--- In boost_at_y..., John Max Skaller <skaller_at_o...> wrote:
> Peter Dimov wrote:
> >
> > From: <jaakko.jarvi_at_c...>
> >
> > > > - Should indexing from 0 to n-1 be supported? Isn't 0-based
indexing
> > > > more intuitive in C++?
> >
> > > This is a matter of taste. Others?
> >
> > Zero-based indexing is usually more intuitive, however, when tuple
is used
> > as a building block for a bind/lambda library, the arguments are
one-based.
> >
> > FWIW, I made the same decision (one-based "tuples") in bind.hpp
(in the
> > vault.)
>
> 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.
>
> :-)
>
> --
> John (Max) Skaller, mailto:skaller_at_m...
> 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
> checkout Vyper http://Vyper.sourceforge.net
> download Interscript http://Interscript.sourceforge.net


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