yat  0.18pre
Public Types | Public Member Functions | Friends | Related Functions | List of all members
theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator > Class Template Reference

WeightedIterator. More...

#include <yat/utility/WeightedIterator.h>

Inheritance diagram for theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >:

Public Types

typedef DataIterator data_iterator
 DataIterator.
 
typedef WeightIterator weight_iterator
 DataIterator.
 

Public Member Functions

 WeightedIterator (void)
 Default Constructor. More...
 
 WeightedIterator (DataIterator d, WeightIterator w)
 Constructor.
 
const DataIteratordata_base (void) const
 
const WeightIteratorweight_base (void) const
 
DataWeightProxy< DataIterator, WeightIteratoroperator[] (int n) const
 element operator
 
template<typename D2 , typename W2 >
 WeightedIterator (WeightedIterator< D2, W2 > other, typename boost::enable_if_convertible< D2, DataIterator >::type *=0, typename boost::enable_if_convertible< W2, WeightIterator >::type *=0)
 Conversion constructor. More...
 

Friends

class boost::iterator_core_access
 

Related Functions

(Note that these are not member functions.)

template<typename DataIterator , typename WeightIterator >
WeightedIterator< DataIterator, WeightIteratorweighted_iterator (DataIterator data, WeightIterator weight)
 convenient function to create WeightedIterator More...
 

Detailed Description

template<typename DataIterator, typename WeightIterator>
class theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >

WeightedIterator.

Adaptor enabling to make two unweighted iterators to behave like a Weighted Iterator. The data part corresponds to the data_iterator and the weight corresponds to the weight_iterator.

WeightedIterator is a Weighted Iterator and its value_type is DataWeight. However due to the nature of this adaptor there are no physical DataWeight in memory that WeightedIterator points to, so its reference_type is not DataWeight& but a DataWeightProxy. As a proxy is used, which is not allowed in a Forward Iterator, WeightedIterator is a Input Iterator.

Although WeightedIterator is tagged a Input Iterator, more advanced traversal is implemented if supported by underlying iterators. If underlying iterators support random access traversal, e.g., WeightedIterator supports it as well and boost::iterator_traversal<T>::type is set appropriately (see Random Access Traversal Iterator).

Type Requirements:

Constructor & Destructor Documentation

template<typename DataIterator, typename WeightIterator>
theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >::WeightedIterator ( void  )
inline

Default Constructor.

Created iterator is not dereferencable

Since
New in yat 0.6
template<typename DataIterator, typename WeightIterator>
template<typename D2 , typename W2 >
theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >::WeightedIterator ( WeightedIterator< D2, W2 >  other,
typename boost::enable_if_convertible< D2, DataIterator >::type *  = 0,
typename boost::enable_if_convertible< W2, WeightIterator >::type *  = 0 
)
inline

Conversion constructor.

Create a WeightIterator<Base> from a WeightIterator<B2>. Possible if B2 is convertible to a Base. Constructor allows implicit conversions such as iterator to const_iterator.

Member Function Documentation

template<typename DataIterator, typename WeightIterator>
const DataIterator& theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >::data_base ( void  ) const
inline
Returns
const reference to underlying data iterator
template<typename DataIterator, typename WeightIterator>
const WeightIterator& theplu::yat::utility::WeightedIterator< DataIterator, WeightIterator >::weight_base ( void  ) const
inline
Returns
const reference to underlying weight iterator

Friends And Related Function Documentation

template<typename DataIterator , typename WeightIterator >
WeightedIterator< DataIterator, WeightIterator > weighted_iterator ( DataIterator  data,
WeightIterator  weight 
)
related

convenient function to create WeightedIterator

Convenient function in same fashion as std::make_pair.


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

Generated on Sun Sep 27 2020 02:26:15 for yat by  doxygen 1.8.11