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

WeightIterator. More...

#include <yat/utility/WeightIterator.h>

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

Public Member Functions

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

Related Functions

(Note that these are not member functions.)

template<typename Base >
WeightIterator< Base > weight_iterator (Base base)
 convenient function to create WeightIterator More...
 

Detailed Description

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

WeightIterator.

WeightIterator is an iterator adaptor that enables iterating over a weighted range but accessing only the weight part of the range. The iterator behaves just like it Base iterator except that operator* returns iterator_traits<Base>.weight(base), i.e., the weight 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(weight_iterator(weighted_vec.begin()),
weight_iterator(weighted_vec.end()),
vec.begin());

Type Requirement:

Constructor & Destructor Documentation

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

Default Constructor.

Since
New in yat 0.6
template<typename Base>
template<typename B2 >
theplu::yat::utility::WeightIterator< Base >::WeightIterator ( WeightIterator< B2 >  other,
typename boost::enable_if_convertible< B2, Base >::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 Base>
iterator_traits<Base>::weight_reference theplu::yat::utility::WeightIterator< Base >::operator* ( void  ) const
inline

using iterator_traits::weight on Base iterator

Returns
weight

Friends And Related Function Documentation

template<typename Base >
WeightIterator< Base > weight_iterator ( Base  base)
related

convenient function to create WeightIterator

Convenient function in same fashion as std::make_pair.


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

Generated on Tue Sep 26 2017 02:33:31 for yat by  doxygen 1.8.5