Boost logo

Boost :

Subject: Re: [boost] [mpl]iter_fold_if Forward Backward rationale?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-04-21 12:36:45


On 04/15/09 11:39, Larry Evans wrote:
> On 04/13/09 16:40, David Abrahams wrote:
> > on Thu Apr 09 2009, Larry Evans <cppljevans-AT-suddenlink.net wrote:
>
> [snip]
>
> >> With the change shown in attachment, the mpl tests
> >> passsed, as shown in the vault's:
>
> > Of course it does. The change has no effect, because the predicate
> > is never executed on the past-the-end position.
>
> The following zip file in the vault's variadic_template directory:
>
> http://preview.tinyurl.com/c6h7vc
>
> contains:
>
> 1) iter_fold_if_bkprotect.cpp
> 2) iter_fold_if_bkprotect.compile
> 3) iter_fold_if.hpp
>
> The .cpp file compiles with the change; however, without the
> change, it fails to compile with some error message suggesting an
> attempt to deref l_end:
>
[snip]
In the same vaule directory, there's:

   iter_fold_if_bkprotect2.zip

This contains modified versions of:

   mpl/iter_fold_if.hpp
   mpl/aux_/iter_fold_if_impl.hpp

as well as the test driver and more compilations. The
iter_fold_if_impl.hpp file was modified by copying parts of the
preprocessor output into the file and disabling the parts that were
replaced. This enabled seeing where the errors were occuring. Also,
several MPL_ASSERTS were placed in that file to check where the end
iterator was being passed to the iter_fold_if_backward_step
template. The *.sizeI.compile files shows where the assertions fail.
There's always at least one assertion failure. The number of failures
is governed by the size of the input sequence.

AFAICT, the iter_fold_if_backward_step should never be passed the end
iterator; hence, there's a bug in iter_fold_if_impl.hpp.

Am I missing something?

-regards,
Larry


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