Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
AddressExposingIter< IT > Class Template Reference

#include "lib/iter-adapter-ptr-deref.hpp"

Description

template<class IT>
class lib::AddressExposingIter< IT >

wrapper for an existing Iterator type to expose the address of each value yielded.

Typically this can be used to build visitation sequences based on values living within a stable data structure (e.g. unmodifiable STL vector)

Warning
use of this wrapper might lead to taking the address of temporaries. The continued existence of the exposed storage locations must be guaranteed.
Note
bool checkable if and only if source is...

Definition at line 221 of file iter-adapter-ptr-deref.hpp.

Public Types

using pointer = IT::pointer const *
 
using reference = IT::pointer const &
 
using value_type = IT::pointer const
 

Public Member Functions

 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (AddressExposingIter)
 
 AddressExposingIter (IT srcIter)
 AddressExposingIter is always created by wrapping an existing iterator.
 
 operator bool () const
 
reference operator* () const
 
_Ptr operator-> () const
 
AddressExposingIteroperator++ ()
 
bool isValid () const
 
bool empty () const
 
IT const & getBase () const
 access the wrapped implementation iterator
 

Private Types

using _Ptr = IT::pointer
 

Private Member Functions

void takeAddress ()
 

Private Attributes

IT i_
 nested source iterator
 
_Ptr currPtr_
 

Constructor & Destructor Documentation

◆ AddressExposingIter()

template<class IT >
AddressExposingIter ( IT  srcIter)
inlineexplicit

AddressExposingIter is always created by wrapping an existing iterator.

Definition at line 252 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::takeAddress().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ _Ptr

template<class IT >
using _Ptr = IT::pointer
private

Definition at line 223 of file iter-adapter-ptr-deref.hpp.

◆ pointer

template<class IT >
using pointer = IT::pointer const*

Definition at line 241 of file iter-adapter-ptr-deref.hpp.

◆ reference

template<class IT >
using reference = IT::pointer const&

Definition at line 242 of file iter-adapter-ptr-deref.hpp.

◆ value_type

template<class IT >
using value_type = IT::pointer const

Definition at line 243 of file iter-adapter-ptr-deref.hpp.

Member Function Documentation

◆ takeAddress()

template<class IT >
void takeAddress ( )
inlineprivate

Definition at line 231 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::currPtr_, and AddressExposingIter< IT >::i_.

Referenced by AddressExposingIter< IT >::AddressExposingIter(), and AddressExposingIter< IT >::operator++().

+ Here is the caller graph for this function:

◆ ENABLE_USE_IN_STD_RANGE_FOR_LOOPS()

template<class IT >
ENABLE_USE_IN_STD_RANGE_FOR_LOOPS ( AddressExposingIter< IT >  )

◆ operator bool()

template<class IT >
operator bool ( ) const
inlineexplicit

Definition at line 259 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::isValid().

+ Here is the call graph for this function:

◆ operator*()

template<class IT >
reference operator* ( ) const
inline
Returns
address of the source iteraor's current result
Warning
exposing a reference to an internal pointer for sake of compatibility. Clients must not store that reference, but rather use it to initialise a copy. The internal pointer exposed here will be changed on increment.

Definition at line 275 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::currPtr_.

◆ operator->()

template<class IT >
_Ptr operator-> ( ) const
inline

Definition at line 281 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::currPtr_.

◆ operator++()

template<class IT >
AddressExposingIter & operator++ ( )
inline

Definition at line 287 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::i_, and AddressExposingIter< IT >::takeAddress().

+ Here is the call graph for this function:

◆ isValid()

template<class IT >
bool isValid ( ) const
inline

Definition at line 295 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::i_.

Referenced by AddressExposingIter< IT >::empty(), and AddressExposingIter< IT >::operator bool().

+ Here is the caller graph for this function:

◆ empty()

template<class IT >
bool empty ( ) const
inline

Definition at line 301 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::isValid().

+ Here is the call graph for this function:

◆ getBase()

template<class IT >
IT const & getBase ( ) const
inline

access the wrapped implementation iterator

Definition at line 309 of file iter-adapter-ptr-deref.hpp.

References AddressExposingIter< IT >::i_.

Referenced by lib::operator==().

+ Here is the caller graph for this function:

Member Data Documentation

◆ i_

◆ currPtr_

template<class IT >
_Ptr currPtr_
mutableprivate
+ Collaboration diagram for AddressExposingIter< IT >:

The documentation for this class was generated from the following file: