Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2006-01-01 20:23:29


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Arkadiy Vertleyb

> > > REPEAT
> > > ENUM
> > > SEQ_ENUM
> > > SEQ_FOR_EACH_I
> > > SEQ_FOLD_LEFT
> >
> > Which one is failing?
>
> I know that REPEAT is working and SEQ_FOR_EACH_I is failing
> -- if you want me I can try the rest.

As you alluded to, SEQ_FOR_EACH_I is not auto-recursive, and thus can't be used
inside itself. In order to make it as generally useful as possible, you can
respecify you're macro so it only uses auto-recursive constructs.

To give you an idea of why it isn't designed to work... SEQ_FOR_EACH_I is
implemented in terms of FOR. SEQ_FOR_EACH_I passes to FOR a predicate (which
determines if the sequence is "nil"), an operation (which increments 'i' and
pops the head of the sequence), and a target macro (which calls the user-defined
macro passed to SEQ_FOR_EACH_I). In order to make the above work, you'd need to
replicate SEQ_FOR_EACH_I and the target macro passed to FOR however many times
you want it to be reentrant. Of course, for consistency, you'd need to do that
for all of the other higher-order algorithms that are built on top of other
higher-order algorithms in the library--which is a lot of replication. I
consider this a huge extensibility failure of the pp-lib (and have for several
years now).

> Happy New Year!

To you as well.

Regards,
Paul Mensonides


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