Boost logo

Boost :

Subject: Re: [boost] [mpl]iter_fold_if Forward Backward rationale?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-04-25 09:15:57


On 04/22/09 11:19, Larry Evans wrote:
> On 04/21/09 11:36, Larry Evans wrote:
> > On 04/15/09 11:39, Larry Evans wrote:
> [snip]
>
> > > The following zip file in the vault's variadic_template directory:
> > >
> > > http://preview.tinyurl.com/c6h7vc
> > >
[snip]

> There's now in the same vault directory, while.cpp. This demonstrates
> how a while_ template can be used with an explicit stack to avoid the
> problems of iter_fold_if accessing the end iterator. The exlicit
> stack is the 3ird parameter to:
>
> template
> < typename Iter
> , typename State
> , typename Stack
> >
> struct forward_state
> ;
>
> This stack is built up during the 1st while_ instantiation and then
> that stack is traversed during the 2nd while_ instantiation.
[snip]

However, the if_recur template attached to a previous post:

   http://article.gmane.org/gmane.comp.lib.boost.devel/188322

could be used to accomplish the same task. The Else parameter
to if_recur could be another ir_recur. The outer if_recur
would perform the task of the 1st while (building up the
stack as well as building the state) and the Else if_recur
would perform the task of the 2nd while.

At least I think so. I haven't tried it yet.

Is there any interest?

-regards,
Larry


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