theplu::yat::utility::iterator_traits< Iter > Struct Template Reference

#include <yat/utility/iterator_traits.h>

List of all members.

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

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.

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

For weighted iterators, data_reference is double& if *Iter has a function double& data(void). Otherwise data_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 Tue Jan 18 02:21:18 2011 for yat by  doxygen 1.5.5