Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-28 00:16:30

> --- In boost_at_y..., Douglas Gregor <gregod_at_c...> wrote:

> I know this, and I'm assuming there are two forms for repetition:
> e[N] - Repeat "e" exactly N times
> e[X][Y] - Repeat "e" at least X and at most Y times (Y can be
> infinity).
> Using the bracket operator for this creates an ambiguity with, for
> instance:
> e[X][Y]
> This could be read as "repeat `e' at least X and at most Y times"
> or "repeat
> `e' X times and then repeat that Y times." If we instead use a syntax
> where
> there is a comma between X and Y, then we've surely differentiated
> between
> two repetition forms (e[X][Y] is obviously different than e[X, Y]).
> Brackets
> unfortunately won't let us do that, but the function call operator()
> will, as
> will free functions.
> Doug

Ahh OK. you mean 'ambiguity' from the client's perspective.
OK, load and clear.

Pardon my inquisitive nature. How about:

a[8]; // exactly 8 times
a[0, more]; // you said can be done, i believe so (comma (,) op)
a[0, until(15)]; // likewise can be done

we can even have:

a[from(0), until(10)] for people who prefer verbosity.

Why the fuss? I want iteration to be very distinct from grouping. Too many
parentheses make the code quite difficult to read except for lisp/scheme

Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at