|
Boost : |
From: Thomas Witt (witt_at_[hidden])
Date: 2002-02-05 11:52:43
On Tuesday 05 February 2002 17:31, you wrote:
> >>>>> "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.
Just to prevent confusion. m_bounds.second is a valid iterator position. It
just can't be dereferenced and so is is not a valid position for the adapted
iterator.
> That's why you
> need to check after you increment, not before, right?
Yes, though I am not sure we mean the same. To me that is
if( ++x.base() == m_bounds.second )
Do you agree?
Thomas
-- Dipl.-Ing. Thomas Witt Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001 http://www.ive.uni-hannover.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk