29 #ifndef CDPL_UTIL_INDEXEDELEMENTITERATOR_HPP
30 #define CDPL_UTIL_INDEXEDELEMENTITERATOR_HPP
34 #include <boost/iterator/iterator_facade.hpp>
122 template <
typename ValueType,
typename AccessFunc,
typename IndexType = std::
size_t>
124 ValueType, boost::random_access_traversal_tag>
127 typedef typename boost::iterator_facade<IndexedElementIterator<ValueType, AccessFunc, IndexType>,
129 boost::random_access_traversal_tag>::difference_type DifferenceType;
136 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
148 accessFunc(access_func), index(start_idx) {}
163 friend class boost::iterator_core_access;
167 void advance(DifferenceType);
169 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
172 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
175 ValueType& dereference()
const;
177 AccessFunc accessFunc;
186 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
192 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
198 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
204 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
210 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
216 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
217 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
218 typename CDPL::Util::IndexedElementIterator<ValueType, AccessFunc, IndexType>::DifferenceType
221 return (DifferenceType(it.index) - DifferenceType(index));
224 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
225 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
228 return (index == it.index && accessFunc == it.accessFunc);
231 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
234 return accessFunc(index);
STL compatible random access iterator for container elements accessible by index.
Definition: IndexedElementIterator.hpp:125
const AccessFunc & getAccessFunc() const
Returns the access functor used by the iterator.
Definition: IndexedElementIterator.hpp:193
IndexType getIndex() const
Returns the index that the iterator currently points to.
Definition: IndexedElementIterator.hpp:187
IndexedElementIterator(const IndexedElementIterator< ValueType2, AccessFunc2, IndexType2 > &it)
Constructs and initializes the iterator with another iterator object.
Definition: IndexedElementIterator.hpp:137
IndexedElementIterator(const AccessFunc &access_func, IndexType start_idx)
Constructs and initializes the iterator with the access function access_func and the start element in...
Definition: IndexedElementIterator.hpp:147
The namespace of the Chemical Data Processing Library.