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

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());
std::copy(data_iterator(weighted_vec.begin()),
data_iterator(weighted_vec.end()),
vec.begin());

Type Requirement:

Constructor & Destructor Documentation

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

Default Constructor.

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

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

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

using iterator_traits::data on Base iterator

Returns
data

Friends And Related Function Documentation

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

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 Sun Sep 27 2020 02:26:14 for yat by  doxygen 1.8.11