42#ifndef TEUCHOS_FILTERED_ITERATOR_HPP
43#define TEUCHOS_FILTERED_ITERATOR_HPP
59template<
class IteratorType,
class Predicate>
69 typedef typename std::iterator_traits<IteratorType>::value_type
value_type;
71 typedef typename std::iterator_traits<IteratorType>::reference
reference;
73 typedef typename std::iterator_traits<IteratorType>::pointer
pointer;
75 typedef typename std::iterator_traits<IteratorType>::difference_type
difference_type;
94 template<
class IteratorType2,
class Predicate2>
99 template<
class IteratorType2,
class Predicate2>
192#ifndef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
199#ifndef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
211template<
class IteratorType,
class Predicate>
215 return itr1.current() ==
itr2.current();
222template<
class IteratorType,
class Predicate>
226 return itr1.current() !=
itr2.current();
236template<
class IteratorType,
class Predicate>
248template<
class IteratorType,
class Predicate>
251 while (current_ != end_ && !pred_(*current_)) {
257template<
class IteratorType,
class Predicate>
260 while (current_ != begin_ && !pred_(*current_)) {
266#ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
269template<
class IteratorType,
class Predicate>
274 "Error, trying to iterate " << *
this <<
" forward ++ past end!");
278template<
class IteratorType,
class Predicate>
283 "Error, trying to iterate " << *
this <<
" backward -- past begin!");
Defines basic traits returning the name of a type in a portable and readable way.
C++ Standard Library compatable filtered iterator.
std::iterator_traits< IteratorType >::value_type value_type
std::ostream & operator<<(std::ostream &out, const FilteredIterator< IteratorType, Predicate > &itr)
ostream operator.
std::iterator_traits< IteratorType >::reference reference
IteratorType begin() const
void assertNotIterateBackwardPastBegin()
FilteredIterator & operator=(const FilteredIterator< IteratorType2, Predicate2 > &rhs)
Assign different types of iterators (mainly for non-const to const).
std::iterator_traits< IteratorType >::difference_type difference_type
reference operator*() const
itr*
FilteredIterator(IteratorType current_in, IteratorType begin_in, IteratorType end_in, Predicate pred_in=Predicate())
Construct with iterator and range.
std::bidirectional_iterator_tag iterator_category
const FilteredIterator operator--(int)
itr–
FilteredIterator(const FilteredIterator< IteratorType2, Predicate2 > &rhs)
Convert type of iterators (mainly for non-const to const).
pointer operator->() const
itr->member
FilteredIterator & operator++()
++itr
void assertNotIterateForwardPastEnd()
FilteredIterator & operator--()
–itr
bool operator!=(const FilteredIterator< IteratorType, Predicate > &itr1, const FilteredIterator< IteratorType, Predicate > &itr2)
itr1 != itr2.
const FilteredIterator operator++(int)
itr++
IteratorType current() const
bool operator==(const FilteredIterator< IteratorType, Predicate > &itr1, const FilteredIterator< IteratorType, Predicate > &itr2)
itr1 == itr2.
void advanceForwardToValid()
std::iterator_traits< IteratorType >::pointer pointer
FilteredIterator()
construct to a null iterator.
void advanceBackwardToValid()
Range error exception class.
Concrete serial communicator subclass.
static std::string name()
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.