Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/iter-adapter-ptr-deref.hpp"
wrapper for an existing Iterator type, automatically dereferencing the output of the former.
For this to work, the "source" iterator is expected to be declared on pointers rather than on values.
Definition at line 56 of file iter-adapter-ptr-deref.hpp.
Public Types | |
using | ConstIterType = PtrDerefIter< WrappedConstIterType > |
using | IterType = PtrDerefIter< WrappedIterType > |
using | pointer = typename meta::ValueTypeBinding< IT >::value_type |
this iterator adapter is meant to wrap an iterator yielding pointer values | |
using | reference = value_type & |
using | value_type = typename std::remove_pointer_t< pointer > |
using | ValueTypeBase = typename std::remove_const_t< value_type > |
using | WrappedConstIterType = typename IterType< IT >::template SimilarIter< const ValueTypeBase **>::Type |
using | WrappedIterType = typename IterType< IT >::template SimilarIter< ValueTypeBase **>::Type |
Public Member Functions | |
PtrDerefIter (IT srcIter) | |
PtrDerefIter is always created by wrapping an existing iterator. | |
PtrDerefIter (PtrDerefIter< WrappedIterType > const &oIter) | |
allow copy initialisation also when the wrapped iterator is based on some variation of a pointer. More... | |
bool | empty () const |
ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (PtrDerefIter) | |
IT const & | getBase () const |
access the wrapped implementation iterator | |
bool | isValid () const |
operator bool () const | |
reference | operator* () const |
PtrDerefIter & | operator++ () |
pointer | operator-> () const |
PtrDerefIter & | operator= (PtrDerefIter< WrappedIterType > const &ref) |
Static Public Member Functions | |
static PtrDerefIter | build_by_cast (WrappedIterType const &srcIter) |
explicit builder to allow creating a const variant from the basic srcIter type. More... | |
static PtrDerefIter | nil () |
Private Attributes | |
IT | i_ |
nested source iterator | |
|
inline |
allow copy initialisation also when the wrapped iterator is based on some variation of a pointer.
Especially, this includes initialisation of the "const variant" from the "normal variant" of PtrDerefIter. Actually, we need to convert in this case by brute force, because indeed (const TY *)* is not assignable from (TY *)* – just we know that our intention is to dereference both levels of pointers, and then the resulting conversion is correct.
Definition at line 108 of file iter-adapter-ptr-deref.hpp.
References PtrDerefIter< IT >::getBase().
|
inlinestatic |
explicit builder to allow creating a const variant from the basic srcIter type.
Again, the reason necessitating this "backdoor" is that we want to swallow one level of indirection. Generally speaking const T **
is not the same as T * const *
, but in our specific case the API ensures that a PtrDerefIter<WrappedConstIterType>
only exposes const elements.
Definition at line 134 of file iter-adapter-ptr-deref.hpp.
References PtrDerefIter< IT >::i_.