yat  0.18pre
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

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.

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

template<typename Iter>
data_reference theplu::yat::utility::iterator_traits< Iter >::data ( Iter  iter) const
inline
Returns
data of iterator iter
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 Sun Sep 27 2020 02:26:14 for yat by  doxygen 1.8.11