TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >

#include <triqs/utility/dressed_iterator.hpp>

Detailed Description

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
struct triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >

STL-compatible iterator that wraps an underlying iterator and dereferences to a user-supplied dressing type.

Given an iterator type IteratorType and a small dressing struct Dressing whose constructor takes the iterator (and optionally an auxiliary pointer) and exposes the data via references, dressed_iterator produces a bidirectional or forward iterator (depending on the iterator category of the given iterator type) generated via boost::iterator_facade. Dereferencing the iterator returns a fresh Dressing constructed from the current underlying iterator state.

Optionally, an auxiliary pointer (typically to the parent container) can be carried along — useful e.g. for cyclic iterators that need to consult the container size.

Template Parameters
IteratorTypeUnderlying iterator type.
DressingLightweight view struct constructed from a single iterator (or iterator + aux pointer).
DressingAuxiliaryArgumentPtrTypeOptional pointer type stored alongside the iterator (void to disable).

Definition at line 69 of file dressed_iterator.hpp.

Public Member Functions

 dressed_iterator ()=default
 Default constructor leaves the underlying iterator and auxiliary pointer uninitialized.
template<typename T>
 dressed_iterator (T const &it, DressingAuxiliaryArgumentPtrType *aux)
 Construct a dressed iterator from an underlying iterator and an auxiliary pointer.
IteratorType & get ()
 Access the underlying iterator.
IteratorType const & get () const
 Access the underlying iterator.
auto * get_aux ()
 Access the auxiliary pointer.
const auto * get_aux () const
 Access the auxiliary pointer.
 operator IteratorType () const
 Implicit conversion back to the underlying iterator type.
template<typename OtherSentinel>
bool operator== (itertools::sentinel_t< OtherSentinel > other)
 Equal-to operator to compare a itertools::sentinel_t type with a dressed iterator.

Constructor & Destructor Documentation

◆ dressed_iterator()

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
template<typename T>
triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::dressed_iterator ( T const & it,
DressingAuxiliaryArgumentPtrType * aux )
inline

Construct a dressed iterator from an underlying iterator and an auxiliary pointer.

Parameters
itUnderlying iterator.
auxAuxiliary pointer (typically to the parent container).

Definition at line 83 of file dressed_iterator.hpp.

Member Function Documentation

◆ get() [1/2]

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
IteratorType & triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::get ( )
inline

Access the underlying iterator.

Returns
Reference to the underlying iterator.

Definition at line 106 of file dressed_iterator.hpp.

◆ get() [2/2]

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
IteratorType const & triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::get ( ) const
inline

Access the underlying iterator.

Returns
Const reference to the underlying iterator.

Definition at line 100 of file dressed_iterator.hpp.

◆ get_aux() [1/2]

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
auto * triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::get_aux ( )
inline

Access the auxiliary pointer.

Returns
Pointer to the auxiliary argument.

Definition at line 115 of file dressed_iterator.hpp.

◆ get_aux() [2/2]

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
const auto * triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::get_aux ( ) const
inline

Access the auxiliary pointer.

Returns
Const pointer to the auxiliary argument.

Definition at line 121 of file dressed_iterator.hpp.

◆ operator==()

template<typename IteratorType, typename Dressing, typename DressingAuxiliaryArgumentPtrType>
template<typename OtherSentinel>
bool triqs::utility::dressed_iterator< IteratorType, Dressing, DressingAuxiliaryArgumentPtrType >::operator== ( itertools::sentinel_t< OtherSentinel > other)
inline

Equal-to operator to compare a itertools::sentinel_t type with a dressed iterator.

Template Parameters
OtherSentinelType of the other sentinel.
Parameters
otherSentinel object to compare with.
Returns
True if the underlying iterator is equal to the sentinel's iterator.

Definition at line 130 of file dressed_iterator.hpp.


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