yat  0.21pre
Public Member Functions | Related Functions | List of all members
theplu::yat::utility::DataIterator< Base > Class Template Reference

DataIterator. More...

#include <yat/utility/DataIterator.h>

Inheritance diagram for theplu::yat::utility::DataIterator< Base >:

Public Member Functions

 DataIterator (Base b)
 Constructor from Base iterator.
 DataIterator (void)
 Default Constructor. More...
template<typename B2 >
 DataIterator (DataIterator< B2 > other, typename boost::enable_if_convertible< B2, Base >::type *=0)
 Conversion constructor. More...
iterator_traits< Base >::data_reference operator* (void) const

Related Functions

(Note that these are not member functions.)

template<typename Base >
DataIterator< Base > data_iterator (Base base)
 convenient function to create DataIterator More...

Detailed Description

template<typename Base>
class theplu::yat::utility::DataIterator< Base >


DataIterator is an iterator adaptor that enables iterating over a weighted range but accessing only the data part. The iterator behaves just like it Base iterator except that operator* returns iterator_traits<Base>.data(base), i.e., the data part is returned.

Here is a short example illustrating typical usage:

std::vector<DataWeight> weighted_vec;
std::vector<double> vec(weighted_vec.size());

Type Requirement:

Constructor & Destructor Documentation

◆ DataIterator() [1/2]

template<typename Base>
theplu::yat::utility::DataIterator< Base >::DataIterator ( void  )

Default Constructor.

New in yat 0.6

◆ DataIterator() [2/2]

template<typename Base>
template<typename B2 >
theplu::yat::utility::DataIterator< Base >::DataIterator ( DataIterator< B2 >  other,
typename boost::enable_if_convertible< B2, Base >::type *  = 0 

Conversion constructor.

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

Member Function Documentation

◆ operator*()

template<typename Base>
iterator_traits<Base>::data_reference theplu::yat::utility::DataIterator< Base >::operator* ( void  ) const

using iterator_traits::data on Base iterator


Friends And Related Function Documentation

◆ data_iterator()

template<typename Base >
DataIterator< Base > data_iterator ( Base  base)

convenient function to create DataIterator

Convenient function in same fashion as std::make_pair.

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

Generated on Thu Sep 22 2022 03:23:06 for yat by  doxygen 1.8.14