Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-09-06 11:24:32


on 9/4/01 2:17 PM, darylew_at_[hidden] at darylew_at_[hidden] wrote:

> I'm trying to use reverse iterators for a bitset iterator class I
> wrote.
> The problem is that my attempts choke on the use of the rbegin
> reverse iterator, which corresponds to the end regular iterator.
> The off-by-1 effect I've read about doesn't happen and the
> reverse iterator tries to dereference past the bitset. What's
> wrong?

There's no reverse iterator issue here. There's just a cut and paste mistake
in your test program. I hope you tried to use the debugger before posting to
Boost -- the problem was obvious to me with a few moments of debugging.

This line

    BOOST_TEST( *t1.first == bs[i - 1] );

needs to be

    BOOST_TEST( *t2.first == bs[i - 1] );

otherwise you dereference the end() value from the forward iterator test.

    -- Darin


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