Gaudi::details::index_iterator< ITERATOR, INDICES > Class Template Reference

"index" iterator iterates ober "indiced" intries in the cotainer/range More...

#include <GaudiKernel/SmartRanges.h>

Inheritance diagram for Gaudi::details::index_iterator< ITERATOR, INDICES >:
Collaboration diagram for Gaudi::details::index_iterator< ITERATOR, INDICES >:

Public Member Functions

 index_iterator (const INDICES &indices, ITERATOR b, ITERATOR e)
 
 index_iterator (INDICES &&indices, ITERATOR b, ITERATOR e)
 
 index_iterator ()
 

Private Member Functions

void increment ()
 
std::iterator_traits< ITERATOR >::reference dereference () const
 
bool equal (const index_iterator &other) const
 

Private Attributes

ITERATOR m_begin
 
std::size_t m_size
 
INDICES m_indices
 
std::size_t m_index
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<class ITERATOR, class INDICES>
class Gaudi::details::index_iterator< ITERATOR, INDICES >

"index" iterator iterates ober "indiced" intries in the cotainer/range

Definition at line 108 of file SmartRanges.h.

Constructor & Destructor Documentation

template<class ITERATOR , class INDICES >
Gaudi::details::index_iterator< ITERATOR, INDICES >::index_iterator ( const INDICES &  indices,
ITERATOR  b,
ITERATOR  e 
)
inline

Definition at line 117 of file SmartRanges.h.

118  : m_begin ( b )
119  , m_size ( std::distance ( b , e ) )
120  , m_indices ( indices )
121  , m_index ( 0 )
122  {}
T distance(T...args)
template<class ITERATOR , class INDICES >
Gaudi::details::index_iterator< ITERATOR, INDICES >::index_iterator ( INDICES &&  indices,
ITERATOR  b,
ITERATOR  e 
)
inline

Definition at line 124 of file SmartRanges.h.

125  : m_begin ( b )
126  , m_size ( std::distance ( b , e ) )
127  , m_indices ( indices )
128  , m_index ( 0 )
129  {}
T distance(T...args)
template<class ITERATOR , class INDICES >
Gaudi::details::index_iterator< ITERATOR, INDICES >::index_iterator ( )
inline

Definition at line 131 of file SmartRanges.h.

132  : m_begin ( )
133  , m_size ( 0 )
134  , m_indices ( )
135  , m_index ( 0 )
136  {}

Member Function Documentation

template<class ITERATOR , class INDICES >
std::iterator_traits<ITERATOR>::reference Gaudi::details::index_iterator< ITERATOR, INDICES >::dereference ( ) const
inlineprivate

Definition at line 151 of file SmartRanges.h.

152  {
153  ITERATOR it = m_begin ;
154  if ( m_index < m_indices.size() )
155  { it = std::next ( m_begin , m_indices[ m_index ] ) ; }
156  return *it;
157  }
T next(T...args)
template<class ITERATOR , class INDICES >
bool Gaudi::details::index_iterator< ITERATOR, INDICES >::equal ( const index_iterator< ITERATOR, INDICES > &  other) const
inlineprivate

Definition at line 159 of file SmartRanges.h.

160  {
161  if ( m_index == other.m_index && m_indices.size() == other.m_indices.size() ) { return true ; }
162  return // special stuff to catch "end"
163  ( m_index == m_indices.size() ) &&
164  ( other.m_index == other.m_indices.size() ) ;
165  }
template<class ITERATOR , class INDICES >
void Gaudi::details::index_iterator< ITERATOR, INDICES >::increment ( )
inlineprivate

Definition at line 141 of file SmartRanges.h.

142  {
143  if ( m_index < m_indices.size() )
144  {
145  // 1. advance
146  ++m_index ;
147  // 2. advance further, if out of range
148  if ( m_size <= m_indices[m_index] ) { increment () ; }
149  }
150  }

Friends And Related Function Documentation

template<class ITERATOR , class INDICES >
friend class boost::iterator_core_access
friend

Definition at line 140 of file SmartRanges.h.

Member Data Documentation

template<class ITERATOR , class INDICES >
ITERATOR Gaudi::details::index_iterator< ITERATOR, INDICES >::m_begin
private

Definition at line 169 of file SmartRanges.h.

template<class ITERATOR , class INDICES >
std::size_t Gaudi::details::index_iterator< ITERATOR, INDICES >::m_index
private

Definition at line 172 of file SmartRanges.h.

template<class ITERATOR , class INDICES >
INDICES Gaudi::details::index_iterator< ITERATOR, INDICES >::m_indices
private

Definition at line 171 of file SmartRanges.h.

template<class ITERATOR , class INDICES >
std::size_t Gaudi::details::index_iterator< ITERATOR, INDICES >::m_size
private

Definition at line 170 of file SmartRanges.h.


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