Subject: Re: [boost] [mpl]iter_fold_if Forward Backward rationale?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-29 17:02:55


AMDG

David Abrahams wrote:
> on Tue May 19 2009, Larry Evans <cppljevans-AT-suddenlink.net> wrote:
>
>>> Alas. AFAICT, there are no tests or uses for the Backward Predicate
>>> in MPL.
>>>
>>>
>> However, there may be a use in the future.
>>
>
> That's really no excuse ;-)
>
> I think this is probably a case of premature generalization.
>

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. The only case where it is significantly more convenient
to use the backward predicate is when doing both a forward and a reverse
operation. For this case, what is really needed is the ability to give
iter_fold_if
a lambda expression which will be used to package the result of the forward
operation for the backwards operation. (This is all premature
generalization
of course...)

In Christ,
Steven Watanabe