Lumiera  0.pre.03
»edit your freedom«
iter-adapter-ptr-deref.hpp File Reference

Go to the source code of this file.

Description

Extension adapter for Lumiera Forward Iterators to dereference any pointer values automatically.

Sometimes, the iteration of some container naturally just yields pointers to contained values. But, from a viewpoint of interface design, we'd prefer the iterator to expose direct references (NULL values can be excluded). This helper template does precisely this: it wraps up any other entity conforming to the »Lumiera Forward Iterator« concept and, on access, automatically dereferences the exposed pointer.

In addition, the reversed operation is also supported through another helper template: to take the address of any value exposed by the given underlying iterator

See also
iter-adapter-test.cpp
iter-adapter.hpp basic iterator adapters
itertools.hpp

Definition in file iter-adapter-ptr-deref.hpp.

#include "lib/iter-adapter.hpp"
#include <type_traits>

Classes

class  AddressExposingIter< IT >
 wrapper for an existing Iterator type to expose the address of each value yielded. More...
 
class  PtrDerefIter< IT >
 wrapper for an existing Iterator type, automatically dereferencing the output of the former. More...
 

Functions

template<class I1 , class I2 >
bool operator!= (PtrDerefIter< I1 > const &il, PtrDerefIter< I2 > const &ir)
 
template<class I1 , class I2 >
bool operator!= (AddressExposingIter< I1 > const &il, AddressExposingIter< I2 > const &ir)
 
template<class I1 , class I2 >
bool operator== (PtrDerefIter< I1 > const &il, PtrDerefIter< I2 > const &ir)
 Supporting equality comparisons...
 
template<class I1 , class I2 >
bool operator== (AddressExposingIter< I1 > const &il, AddressExposingIter< I2 > const &ir)
 Supporting equality comparisons...
 
template<class IT >
auto ptrDeref (IT iter)
 Convenience shortcut to dereference pointers yielded from the wrapped iterator.
 

Namespaces

 lib
 Implementation namespace for support and library code.