# Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-26 09:53:17

On Saturday 26 May 2001 07:49 am, you wrote:
> From: "joel de guzman" <joel_at_[hidden]>
>
> > From: "Larry Evans" :
> > > "John (EBo) David" wrote:
> > > > From: "joel de guzman":
> > > > > From: "Douglas Gregor":
> > > >
> > > > haven't though much about it, but how about "digit[0][2]" or
> > > > "(a|b|c)[0][more]" instead...
> > > > couldn't that work?
> > >
> > > I think the problem here is what's the type of digit[0]? If it's
> > > like arrays, then digit is rank2, digit[0] is rank1, and digit[0][2]
> > > is rank0. On the other hand, if you claim that all are rank 0, then
> > > how do you distinguish whether the i in Parser::operator[](int i) is
> > > for the min or max repititions of *this?
> >
> > I certainly can do this in the framework. In my other post:
> > >
> > > a[2]; // exactly 2
> > > a[0][2]; // 0..2
> > > a[0][more]; // 0...
> > > a[1][more]; // 1...
> > >
> > > This can be done.
>
> Yep... Since I now get the Boost in digest form sometimes my responses
> are a little behind the needle of the thread. Sorry for restating
>
> > > PS> Do I hear yuck?
> >
> > Greg Colvin said: Yuck. I rather see a.repeat(0,more) or
> > repeat<0,more>(a).
>
> I agree. I think that reads much more clear to me. The [][] idea is
> only useful if you REALLY want to use []'s.

I also like the a.repeat(0, more) and repeat<0, more>(a) syntax, though my
preference would be to remove some of the extra typing and go to:

a<0, more>()
a(0, more)

Supporting both may help some optimizations but also allows variable lengths.

Doug