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) {}
155 friend class boost::iterator_core_access;
159 void advance(DifferenceType);
161 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
164 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
167 ValueType& dereference()
const;
169 AccessFunc accessFunc;
178 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
184 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
190 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
196 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
202 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
208 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
209 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
210 typename CDPL::Util::IndexedElementIterator<ValueType, AccessFunc, IndexType>::DifferenceType
213 return (DifferenceType(it.index) - DifferenceType(index));
216 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
217 template <
typename ValueType2,
typename AccessFunc2,
typename IndexType2>
220 return (index == it.index && accessFunc == it.accessFunc);
223 template <
typename ValueType,
typename AccessFunc,
typename IndexType>
226 return accessFunc(index);
A STL compatible random access iterator for container elements accessible by index.
Definition: IndexedElementIterator.hpp:125
const AccessFunc & getAccessFunc() const
Definition: IndexedElementIterator.hpp:185
IndexType getIndex() const
Definition: IndexedElementIterator.hpp:179
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.