BTK::PredicateIterator< Predicate, Iterator, Strategy > Class Template Reference
#include <predicate_iterator.h>
Collaboration diagram for BTK::PredicateIterator< Predicate, Iterator, Strategy >:
[legend]List of all members.
Detailed Description
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>>
class BTK::PredicateIterator< Predicate, Iterator, Strategy >
PredicateIterator class. The PredicateIterator is a model of the STL concept Forward Iterator, with the notable exception that it takes a Predicate, which is an object that is used to select which elements are iterated over. In other words, elements that do not match the condition(s) specified by the Predicate are skipped over during iteration.
PredicateIterators may be constructed using any iterator type that supports the Forward Iterator interface, and any predicate type that is A) default constructable, B) copy constructable, and C) provides an operator() that accepts a T const & (where T is the value_type of the iterator), and returns a boolean value (true = will be iterated, false == will be skipped).
In order to implement selection most efficiently, a "match list" is precomputed when the PredicateIterator is constructed, and this list is used during iteration. Thus, the PredicateIterator iterates in amortized constant time, regardless of the complexity of the Predicate itself. Copying of PredicateIterators is also guaranteed to be performed in amortized constant time. Construction, for obvious reasons, is O(n), where n is the length of the sequence range being iterated.
Member Typedef Documentation
|
|
STL-required iterator typedefs. Note that these are created using the std::iterator_traits template, which is part of the C++ standard, but makes use of partial template specialization, and thus may not be supported by older compilers. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef std::forward_iterator_tag BTK::PredicateIterator< Predicate, Iterator, Strategy >::iterator_category
|
|
|
|
STL-required iterator typedefs. Note that these are created using the std::iterator_traits template, which is part of the C++ standard, but makes use of partial template specialization, and thus may not be supported by older compilers. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef Iterator BTK::PredicateIterator< Predicate, Iterator, Strategy >::iterator_type
|
|
|
|
Useful, but not-STL-required iterator typedefs. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef std::iterator_traits<Iterator>::pointer BTK::PredicateIterator< Predicate, Iterator, Strategy >::pointer
|
|
|
|
STL-required iterator typedefs. Note that these are created using the std::iterator_traits template, which is part of the C++ standard, but makes use of partial template specialization, and thus may not be supported by older compilers. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef Predicate BTK::PredicateIterator< Predicate, Iterator, Strategy >::predicate_type
|
|
|
|
Useful, but not-STL-required iterator typedefs. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef std::iterator_traits<Iterator>::reference BTK::PredicateIterator< Predicate, Iterator, Strategy >::reference
|
|
|
|
STL-required iterator typedefs. Note that these are created using the std::iterator_traits template, which is part of the C++ standard, but makes use of partial template specialization, and thus may not be supported by older compilers. |
|
|
Useful, but not-STL-required iterator typedefs. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef Strategy BTK::PredicateIterator< Predicate, Iterator, Strategy >::strategy_type
|
|
|
|
Useful, but not-STL-required iterator typedefs. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| typedef std::iterator_traits<Iterator>::value_type BTK::PredicateIterator< Predicate, Iterator, Strategy >::value_type
|
|
|
|
STL-required iterator typedefs. Note that these are created using the std::iterator_traits template, which is part of the C++ standard, but makes use of partial template specialization, and thus may not be supported by older compilers. |
Constructor & Destructor Documentation
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| BTK::PredicateIterator< Predicate, Iterator, Strategy >::PredicateIterator |
( |
Iterator const & |
begin, |
|
|
Iterator const & |
end, |
|
|
Predicate const & |
p = Predicate() |
|
) |
[inline] |
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| BTK::PredicateIterator< Predicate, Iterator, Strategy >::PredicateIterator |
( |
Iterator const & |
end, |
|
|
Predicate const & |
p = Predicate() |
|
) |
[inline] |
|
Member Function Documentation
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| reference BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator * |
( |
|
) |
const [inline] |
|
|
|
Iterator dereference operator.
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator!= |
( |
Iterator const & |
rhs |
) |
const [inline] |
|
|
|
Equality/Inequality comparisons. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator!= |
( |
self_type const & |
rhs |
) |
const [inline] |
|
|
|
Equality/Inequality comparisons. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| self_type BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator++ |
( |
int |
|
) |
[inline] |
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| self_type& BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator++ |
( |
|
) |
[inline] |
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| pointer BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator-> |
( |
|
) |
const [inline] |
|
|
|
Iterator arrow dereference operator.
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| self_type& BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator= |
( |
self_type const & |
rhs |
) |
[inline] |
|
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator== |
( |
Iterator const & |
rhs |
) |
const [inline] |
|
|
|
Equality/Inequality comparisons. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool BTK::PredicateIterator< Predicate, Iterator, Strategy >::operator== |
( |
self_type const & |
rhs |
) |
const [inline] |
|
|
|
Equality/Inequality comparisons. |
Friends And Related Function Documentation
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool operator!= |
( |
Iterator const & |
lhs, |
|
|
self_type const & |
rhs |
|
) |
[friend] |
|
|
|
Equality/Inequality comparisons. |
|
template<class Predicate, class Iterator, class Strategy = PointerListStrategy<Predicate,Iterator>> |
| bool operator== |
( |
Iterator const & |
lhs, |
|
|
self_type const & |
rhs |
|
) |
[friend] |
|
|
|
Equality/Inequality comparisons. |
The documentation for this class was generated from the following file:
Generated on Wed Apr 14 00:43:27 2004 for BTK by
1.3.6