Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-06-28 11:41:21


At 08:26 AM 6/28/2001, Peter Dimov wrote:

>Even within a language, sometimes a consistent indexing scheme is
>counter-intuitive. Function arguments for me logically start from one,
not
>zero; there is no conflict because I don't use [] to access them.
>
>Every bind/lambda library I know of uses free1/arg1/_1/whatever1 to refer

>to
>the first argument. The standard library uses bind1st to bind the first
>argument, and std::pair's first element is called 'first.'
>
>Of course every array-like object that is accessed using operator[] uses
>zero-based indexing.
>
>The problem with tuple is that it doesn't fall in either class: if I have
a
>tuple t, I can use neither t[0] nor t.first to refer to its first
element.
>
>So neither "consistency with arrays" nor "consistency with bind libraries
>and std::pair" is a convincing argument. Both schemes are equally valid.

Nice description of the problem.

I considered asking the C++ committee which they prefer, but it might take
them a year, I think, to come up to speed and produce an answer.

tuple seems to me to be slightly closer to the "consistency with bind
libraries and std::pair" case, but I think we should defer to the
developers, since it isn't an open and shut case.

The library developers need to make up their minds, and then be very sure
to include rationale like the above in the documentation.

--Beman


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