Subject: Re: [boost] [mpl]iter_fold_if Forward Backward rationale?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-04-05 09:39:51
On 04/04/09 12:41, Larry Evans wrote:
> Now, if B==F==push_front, this would produce a palindrome:
> This is demonstrated by the attached program which produces on cout:
> ***test_iter_fold_if<1> numbers=:
> ***test_iter_fold_if<1> result::state=:
> However, I 've not figured out where the extra number (1 in case of
> iter_fold_if<1> and 2 in case of iter_fold_if<2>) is coming from.
> OTOH, I haven't tried very hard to figure it out.
The previous attachment should have had:
push_front<arg<1>,deref<arg<2> > >
as both the ForwardOp and BackwardOp. Also, the
BackwardPredicate should have been:
, typename end<numbers>::type
With those changes, the correct palindrome is produced.
Just as the ForwardPredicate is "augmented" with protection
against dereferencing the end<numbers>::type in this code:
shouldn't the BackwardPredicate also be augmented with the same
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk