Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-10-08 06:43:08


Eric Niebler wrote:

[...]

> Based on the test failure, I'm guessing the actual output will be:
>
> Expected : Foo Bar Baz
> Actual : FOO BAR BAZ

Your expectations were right.

> If that's the case, I'll be asking you to fire up a debugger. I can tell
> you exactly where to look, but only you can tell me what you'll find!

I did so and I think I've found the source of the problem.

The Tru64/CXX std library implements copy as:

   while (first != last) *result++ = *first++;

XPressive uses copy in format_backref_ like this:

         else if(BOOST_XPR_CHAR_(char_type, '&') == *cur) // whole match
         {
             ++cur;
             out = std::copy(
               this->sub_matches_[ 0 ].first,
               this->sub_matches_[ 0 ].second,
               out);
         }

This results in calls of the post increment operator of
case_converting_iterator, which returns a copy of the iterator object. The
assignment operator then modifies this copy and not the original iterator,
nullifying the changes done to the iterator object in the assignment operator.

The test executes OK when I replace the implementation of copy with the
following code:

   while (first != last)
   {
     *result = *first;
     ++first;
     ++result;
   }

HTH, Markus


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