Boost logo

Boost :

Subject: [boost] Boost.Iterator filter_iterator issues
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2009-09-26 11:42:18


I think I've found an issue with boost::filter_iterator when
decrementing a valid iterator without having any predicate evaluating
to true on its way back.

filter_iterator.hpp line# 93 states

void decrement()

which will ?clearly? pass beyond the initial start iterator if no
predicate evaluates to true. Is it a requirement for the iterator
being adapted by filter_iterator to catch decrements past the
containers begin range? The following test will iterate 'iter' past
containers begin iterator which will trigger a debug assertion on

template<class _Iterator>
void dec_iterator(_Iterator iter)
  BOOST_CHECK(*iter == 2);
  --iter; // iterates past begin

  using namespace boost::assign;
  typedef std::vector<int> container_type;

  container_type values = list_of(0)(1)(2);
1), values.begin(), values.end()));

Please help me clarifying this issue.

Best regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at