rpa::iterator_jump_lead< It > Class Template Reference

#include <common.h>

List of all members.

Public Types

typedef std::iterator_traits<
It > 
it_traits
typedef it_traits::iterator_category iterator_category
typedef it_traits::value_type value_type
typedef it_traits::difference_type difference_type
typedef it_traits::pointer pointer
typedef it_traits::reference reference

Public Member Functions

 iterator_jump_lead ()
 iterator_jump_lead (const It &aBeg, const It &aEnd, size_t aJump)
iterator_jump_leadoperator++ (void)
iterator_jump_lead operator++ (int)
 Much more expensive than oper++(void).
iterator_jump_leadoperator+= (size_t anOffset)
 If the base iterator is random_access, so are we.
ptrdiff_t operator- (const iterator_jump_lead &aIJM) const
bool operator== (const iterator_jump_lead &aIJM) const
 Do NOT use operator -, because it may increment the iterators.
bool operator!= (const iterator_jump_lead &aIJM) const
const value_typeoperator * (void) const
 If we must write in a iterator_jump_lead, we'll need a non-const oper*.
value_type operator * (void)
 This is for std::istream_iterator.

Private Member Functions

void check (void) const
ptrdiff_t dist_to_end (void) const

Private Attributes

It _Beg
It _End
 Modified only by 'operator='.
size_t _jump


Detailed Description

template<class It>
class rpa::iterator_jump_lead< It >

It the algorithm has several iterators which must progress synchronously. For example : 'tranform'. Then, the leading iterator (The one which has the begin and the end), is encapsulated into a 'iterator_jump_lead'). This encapsulated iterator jumps several elements each time it is incremented. This is therefore called interleaved scheduling.


Member Typedef Documentation

template<class It>
typedef it_traits::difference_type rpa::iterator_jump_lead< It >::difference_type

template<class It>
typedef std::iterator_traits< It > rpa::iterator_jump_lead< It >::it_traits

template<class It>
typedef it_traits::iterator_category rpa::iterator_jump_lead< It >::iterator_category

template<class It>
typedef it_traits::pointer rpa::iterator_jump_lead< It >::pointer

template<class It>
typedef it_traits::reference rpa::iterator_jump_lead< It >::reference

template<class It>
typedef it_traits::value_type rpa::iterator_jump_lead< It >::value_type


Constructor & Destructor Documentation

template<class It>
rpa::iterator_jump_lead< It >::iterator_jump_lead (  )  [inline]

The two iterators have the same value, even if they have no constructors, like pointers. This figures out that the iterator is pointing on nothing, i.e. is ended.

template<class It>
rpa::iterator_jump_lead< It >::iterator_jump_lead ( const It &  aBeg,
const It &  aEnd,
size_t  aJump 
) [inline]


Member Function Documentation

template<class It>
void rpa::iterator_jump_lead< It >::check ( void   )  const [inline, private]

template<class It>
ptrdiff_t rpa::iterator_jump_lead< It >::dist_to_end ( void   )  const [inline, private]

Computes the number of increments to do, to reach the end. The division has a remainder, and this is normal.

template<class It>
value_type rpa::iterator_jump_lead< It >::operator * ( void   )  [inline]

This is for std::istream_iterator.

template<class It>
const value_type& rpa::iterator_jump_lead< It >::operator * ( void   )  const [inline]

If we must write in a iterator_jump_lead, we'll need a non-const oper*.

template<class It>
bool rpa::iterator_jump_lead< It >::operator!= ( const iterator_jump_lead< It > &  aIJM  )  const [inline]

template<class It>
iterator_jump_lead rpa::iterator_jump_lead< It >::operator++ ( int   )  [inline]

Much more expensive than oper++(void).

template<class It>
iterator_jump_lead& rpa::iterator_jump_lead< It >::operator++ ( void   )  [inline]

The compiler-generated copy constructor and operator=, are OK. Incr and decr operators must 'jump' by the number of threads.

If we reached 'theEnd', we set _jump=0. Tests first if we could succesfully advance, which is the fastest and most probable case.

template<class It>
iterator_jump_lead& rpa::iterator_jump_lead< It >::operator+= ( size_t  anOffset  )  [inline]

If the base iterator is random_access, so are we.

It is probably possible to optimise it because some tests are already done in 'adv'

template<class It>
ptrdiff_t rpa::iterator_jump_lead< It >::operator- ( const iterator_jump_lead< It > &  aIJM  )  const [inline]

We assume that both iterators points to the same container : Therefore, all cases will not occur.

It never happened for the moment, due to the kind of algorithms we have implemented yet : 'transform' and 'accumulate'. This case has a meaning but, for safety, we want to detect it,

template<class It>
bool rpa::iterator_jump_lead< It >::operator== ( const iterator_jump_lead< It > &  aIJM  )  const [inline]

Do NOT use operator -, because it may increment the iterators.

It never happened for the moment, due to the kind of algorithms we have implemented yet : 'transform' and 'accumulate'. This case has a meaning but, for safety, we want to detect it,

The two iterators should point on the same container ??? FALSE FOR POINTERS ??


Member Data Documentation

template<class It>
It rpa::iterator_jump_lead< It >::_Beg [private]

template<class It>
It rpa::iterator_jump_lead< It >::_End [private]

Modified only by 'operator='.

template<class It>
size_t rpa::iterator_jump_lead< It >::_jump [private]


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:37 2007 for rpa by  doxygen 1.4.7