Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-05-25 19:37:11


From: joel de guzman <joel_at_[hidden]>
> From: "Douglas Gregor" :
>
> > > Seigh, I kinda liked [] for iteration to distinguish from
> > > grouping ex:
> > >
> > > (a | b | c)[0, more];
> > >
> > > instead of
> > >
> > > (a | b | c)(0, more);
> > >
> > > Oh well...
> > > Joel de Guzman
> >
> > Actually, the use you describe above is possible. If more has a distinct
> type
> > (i.e., more_t), then you can overload the comma operator to combine the 0
> and
> > the more into a single object, then accept that object in operator[]. The
> > Boost multidimensional array library will likely take this approach.
> >
> > It's the [0, 2] that won't work and would be very, very bad. Since
> > a[0, 2] == a[2] == lots of user errors.
> >
>
> How about:
>
> a[2]; // exactly 2
> a[0][2]; // 0..2
> a[0][more]; // 0...
> a[1][more]; // 1...
>
> This can be done.
>
> Joel de Guzman
>
> PS> Do I hear yuck?

Yuck. I rather see a.repeat(0,more) or repeat<0,more>(a).


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