Subject: Re: [boost] [mpl]iter_fold_if Forward Backward rationale?
From: David Abrahams (dave_at_[hidden])
Date: 2009-06-05 11:00:03
on Wed Jun 03 2009, Larry Evans <cppljevans-AT-suddenlink.net> wrote:
>> Anything that can be done with the backward predicate can be done
>> by passing an appropriate boolean flag along with the result. Unlike the
>> forward predicate, there are no big-O gains from having the algorithm
>> know about it.
> Why not? It seems there should be. After all, if the backward
> predicate is satisfied by the last element in the sequence, wouldn't
> that avoid going back up the recursion stack?
How can you possibly "avoid going back up the recursion stack?" That's
like asking the recursive metafunction invocations not to "return." I
suppose we could cause a compiler error, but I doubt that's what you had
-- Dave Abrahams BoostPro Computing http://www.boostpro.com