Simple iterator wrapper for manipulation of dereferenced result. More...
#include <AssociatedData.h>
Classes | |
| class | ValuePtr |
Value box for use with pointer dereference operator->(). More... | |
Public Types | |
| using | iterator = Iter |
Iterator traits | |
!< The type of base iterator wrapper. | |
| using | value_type = ValueType |
| using | pointer = std::add_pointer_t< value_type > |
| using | reference = std::add_lvalue_reference_t< value_type > |
| using | iterator_category = std::forward_iterator_tag |
Public Member Functions | |
| IteratorWrapperBase ()=default | |
| Default constructor: default-constructs the underlying iterator. More... | |
| IteratorWrapperBase (data_iterator_t const &from) | |
| Copy-from-base constructor. More... | |
| iterator & | operator++ () |
| Prefix increment operator. More... | |
| bool | operator!= (data_iterator_t const &other) const |
| Comparison with a data iterator (makes unnecessary to wrap end iterators). More... | |
| bool | operator!= (iterator const &other) const |
| Comparison with another iterator. More... | |
| auto | operator[] (std::size_t index) const -> decltype(auto) |
| auto | operator* () const -> decltype(auto) |
| Dereference operator; need to be redefined by derived classes. More... | |
| auto | operator-> () const -> decltype(auto) |
| Dereference operator; need to be redefined by derived classes. More... | |
Protected Types | |
| using | data_iterator_t = DataIter |
Protected Member Functions | |
| data_iterator_t const & | asDataIterator () const |
Static Protected Member Functions | |
| static auto | transform (data_iterator_t const &) -> decltype(auto) |
| Transforms and returns the value at the specified data iterator. More... | |
Private Member Functions | |
| iterator const & | asIterator () const |
| iterator & | asIterator () |
Static Private Member Functions | |
| template<typename Value > | |
| static ValuePtr< Value > | makeValuePointer (Value &&value) |
Simple iterator wrapper for manipulation of dereferenced result.
| Iter | final iterator |
| BaseIter | base iterator |
| ValueType | type returned by the new dereference operator |
This class is designed to be used as base class for an iterator that redefines the dereference operations without changing anything else. An example of such iterator is:
This new iterator twice_iterator effectively inherits int_iterator_t constructors (via base_iterator_t). Its operator++() returns a twice_iterator, so that operations like *++it are correctly handled.
Note that the derived classes need to redefine all the dereferencing operators that are supported:
The operator->() is not supported. Typically, operator*() returns a reference and operator->() a pointer to an existing structure. The operator*() is not required to return a reference when the iterator does not allow to modify the pointed data, and the wrapper can manipulate values and return temporary results. To have a similar feature for operator->() requires more work, as it should return a smart pointer that would perform the transformation on dereference.
Definition at line 103 of file AssociatedData.h.
|
protected |
Definition at line 105 of file AssociatedData.h.
| using proxy::details::IteratorWrapperBase< Iter, DataIter, ValueType >::iterator = Iter |
Definition at line 108 of file AssociatedData.h.
| using proxy::details::IteratorWrapperBase< Iter, DataIter, ValueType >::iterator_category = std::forward_iterator_tag |
Definition at line 116 of file AssociatedData.h.
| using proxy::details::IteratorWrapperBase< Iter, DataIter, ValueType >::pointer = std::add_pointer_t<value_type> |
Definition at line 114 of file AssociatedData.h.
| using proxy::details::IteratorWrapperBase< Iter, DataIter, ValueType >::reference = std::add_lvalue_reference_t<value_type> |
Definition at line 115 of file AssociatedData.h.
| using proxy::details::IteratorWrapperBase< Iter, DataIter, ValueType >::value_type = ValueType |
Definition at line 113 of file AssociatedData.h.
|
default |
Default constructor: default-constructs the underlying iterator.
|
inline |
Copy-from-base constructor.
Definition at line 123 of file AssociatedData.h.
|
inlineprotected |
Definition at line 154 of file AssociatedData.h.
|
inlineprivate |
Definition at line 172 of file AssociatedData.h.
|
inlineprivate |
Definition at line 174 of file AssociatedData.h.
|
inlinestaticprivate |
Definition at line 169 of file AssociatedData.h.
|
inline |
Comparison with a data iterator (makes unnecessary to wrap end iterators).
Definition at line 130 of file AssociatedData.h.
|
inline |
Comparison with another iterator.
Definition at line 134 of file AssociatedData.h.
|
inline |
Dereference operator; need to be redefined by derived classes.
Definition at line 141 of file AssociatedData.h.
|
inline |
Prefix increment operator.
Definition at line 126 of file AssociatedData.h.
|
inline |
Dereference operator; need to be redefined by derived classes.
Definition at line 145 of file AssociatedData.h.
|
inline |
Definition at line 137 of file AssociatedData.h.
|
inlinestaticprotected |
Transforms and returns the value at the specified data iterator.
Definition at line 151 of file AssociatedData.h.
1.8.11