yat  0.20.3pre
Public Types | Public Member Functions | List of all members
theplu::yat::utility::iterator_traits< Iter > Struct Template Reference

#include <yat/utility/iterator_traits.h>

Public Types

typedef traits::data_reference data_reference
 
typedef traits::weight_reference weight_reference
 

Public Member Functions

data_reference data (Iter iter) const
 
weight_reference weight (Iter iter) const
 

Detailed Description

template<typename Iter>
struct theplu::yat::utility::iterator_traits< Iter >

The purpose of this class is to allow polymorphism between weighted and unweighted iterators. It allows to access data and weight for both weighted and unweighted iterators.

For weighted iterators this class requires that *Iter has functions data(void) and weight(void).

Member Typedef Documentation

◆ data_reference

template<typename Iter>
typedef traits::data_reference theplu::yat::utility::iterator_traits< Iter >::data_reference

For unweighted iterator, data_reference is the same as std::iterator_traits<Iter>::reference, i.e., the data if the iterator is the same as *Iter.

For weighted iterators, data_reference is double& if *Iter has a function double& data(void). Otherwise data_reference is const double.

◆ weight_reference

template<typename Iter>
typedef traits::weight_reference theplu::yat::utility::iterator_traits< Iter >::weight_reference

For unweighted iterator, weight_reference is const double since the weight is always implicitly 1.0 and not mutable.

For weighted iterators, weight_reference is double& if *Iter has a function double& weight(void). Otherwise weight_reference is const double.

Member Function Documentation

◆ data()

template<typename Iter>
data_reference theplu::yat::utility::iterator_traits< Iter >::data ( Iter  iter) const
inline
Returns
data of iterator iter

◆ weight()

template<typename Iter>
weight_reference theplu::yat::utility::iterator_traits< Iter >::weight ( Iter  iter) const
inline
Returns
weight of iterator iter

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

Generated on Sat Feb 18 2023 03:31:45 for yat by  doxygen 1.8.14