Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2002-02-05 11:31:41


>>>>> "Thomas" == Thomas Witt <witt_at_[hidden]> writes:

    Thomas> On Tuesday 05 February 2002 16:37, you wrote:
>> In increment:
>>
>> if( ++x.base() == m_bounds.second )
>> x.base() = m_bounds.first;
>>
>>
>> Since m_bounds.second is not included in the range, shouldn't that be:
>>
>> if( x.base()++ == m_bounds.second )
>> x.base() = m_bounds.first;
>>

    Thomas> I don't think so. AFAICS

    Thomas> if( x.base()++ == m_bounds.second )

    Thomas> would not prevent us fom incrementing the end iterator.

    Thomas> It is

    Thomas> if( ++x.base() == m_bounds.second )
    Thomas> x.base() = m_bounds.first;

    Thomas> because m_bounds.second is not included in the range so we have to make
    Thomas> sure base does not point to m_bounds.second.

    Thomas> As I am writing this: If you question was should m_bounds.second be a valid
    Thomas> position for the cyclic iterator? I think no. To me providing a half open
    Thomas> range to the policies constructor is the right way to go. Otherwise we would
    Thomas> surely confuse users.

No, m_bounds.second should not be a valid position. That's why you
need to check after you increment, not before, right?


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