Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-27 00:40:38


On Saturday 26 May 2001 10:58 pm, you wrote:
[snip]
> PS> But what if we disallow the third level []?
> e[0] is a paradox even with the other iterator
> styles: e(0) or e.repeat(0). Should it match
> anything or nothing? Matching anything is
> the universal string U. The simplest way out
> thatI could think of is to disallow it.

One would expect e(0) to match nothing because, presumable, e(1) == e,
e(2) = e >> e, etc. That's what I would expect from the single-argument forms.

This goes back to the exact problem that came up with the multidimensional
array library. The following is ambiguous:

e[3][5]

It could equal e[3] | e[4] | e[5] or it could equal e[15].
Now you know why I support using the () syntax or a repeat function instead
of operator[].

I mentioned it back in the multidim library discussions, so I'll mention it
here. If we wanted a large degree of flexibility (as was needed for array
slicing), we could support syntax like:

e[0 <= stride(2) <= 8]

which is equivalent to:

e[0] | e[2] | e[4] | e[6] | e[8]

        Doug


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