forked from boostorg/range
trac 9515 - fix for uniqued adaptor consistent with unique algorithm.
This commit is contained in:
@ -62,54 +62,44 @@ namespace boost
|
||||
, pred_t(pred)
|
||||
, m_last(last)
|
||||
{
|
||||
move_to_next_valid();
|
||||
}
|
||||
|
||||
template<class OtherIter>
|
||||
skip_iterator( const skip_iterator<OtherIter, pred_t, default_pass>& other )
|
||||
: base_t(other.base())
|
||||
, pred_t(other)
|
||||
, m_last(other.m_last) {}
|
||||
|
||||
void move_to_next_valid()
|
||||
, m_last(other.m_last)
|
||||
{
|
||||
iter_t& it = this->base_reference();
|
||||
pred_t& bi_pred = *this;
|
||||
if (it != m_last)
|
||||
{
|
||||
if (default_pass)
|
||||
{
|
||||
iter_t nxt = ::boost::next(it);
|
||||
while (nxt != m_last && !bi_pred(*it, *nxt))
|
||||
{
|
||||
++it;
|
||||
++nxt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iter_t nxt = ::boost::next(it);
|
||||
for(; nxt != m_last; ++it, ++nxt)
|
||||
{
|
||||
if (bi_pred(*it, *nxt))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nxt == m_last)
|
||||
{
|
||||
it = m_last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void increment()
|
||||
{
|
||||
iter_t& it = this->base_reference();
|
||||
BOOST_ASSERT( it != m_last );
|
||||
pred_t& bi_pred = *this;
|
||||
iter_t prev = it;
|
||||
++it;
|
||||
move_to_next_valid();
|
||||
if (it != m_last)
|
||||
{
|
||||
if (default_pass)
|
||||
{
|
||||
while (it != m_last && !bi_pred(*prev, *it))
|
||||
{
|
||||
++it;
|
||||
++prev;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; it != m_last; ++it, ++prev)
|
||||
{
|
||||
if (bi_pred(*prev, *it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iter_t m_last;
|
||||
|
Reference in New Issue
Block a user