Boost logo

Boost :

From: joel de guzman (joel_at_[hidden])
Date: 2001-05-25 20:05:51


From: "Greg Colvin" :

> > 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).
>

:-) loud and clear.

Actually, repeat<0,more> forces constant parameters.
I prefer functions because I can have variables as parameters.
This way I can do dynamic iteration. I mentioned that a while
ago in passing. For example when parsing a length prefixed
string from a file. This type of 'dynamic iteration' is invaluable
in cases such as 1) parsing files (even binary files) 2)
resource description, 3) external data representation (e.g. XDR)
including externalisation of objects (persistence) and
inter-application/inter-network communication.

Joel de Guzman


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