This class adapts any iterator so that operator* returns another element than the one pointed to by the iterator.
More...
template<typename TIterator, typename TLightFunctor, typename TReturnType = typename TLightFunctor::Value>
class DGtal::ConstIteratorAdapter< TIterator, TLightFunctor, TReturnType >
This class adapts any iterator so that operator* returns another element than the one pointed to by the iterator.
Description of template class 'ConstIteratorAdapter'
- Template Parameters
-
TIterator | the type of the iterator to adapt. |
To achieve this goal, the adapter is based on a functor f given at construction so that operator* calls f(*it), instead of calling directly operator* of the underlying iterator it.
- Note
- This ConstIteratorAdapter does not satisfy the __is_forward_iterator concept of the STL. It can be a problem if it used through the std::max_element() function that requires a ForwardIterator. In this case you could use the boost::first_max_element function.
- Template Parameters
-
TLightFunctor | the type of functor that transforms the pointed element into another one (required to be light because the functor is passed by value) |
TReturnType | the type of the element returned by the underlying functor (if TLightFunctor has a nested type called 'Value', TReturnType is set to TLightFunctor::Value by default) |
NB: from boost/iterator/transform_iterator.hpp
Definition at line 85 of file ConstIteratorAdapter.h.