Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::counting_iterator< IntType > Class Template Reference

#include <iterators.h>

Collaboration diagram for tbb::counting_iterator< IntType >:

Public Types

typedef IntType value_type
 
typedef const IntType * pointer
 
typedef const IntType & reference
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 counting_iterator (IntType init)
 
reference operator * () const
 
value_type operator[] (difference_type i) const
 
difference_type operator- (const counting_iterator &it) const
 
counting_iteratoroperator+= (difference_type forward)
 
counting_iteratoroperator-= (difference_type backward)
 
counting_iteratoroperator++ ()
 
counting_iteratoroperator-- ()
 
counting_iterator operator++ (int)
 
counting_iterator operator-- (int)
 
counting_iterator operator- (difference_type backward) const
 
counting_iterator operator+ (difference_type forward) const
 
bool operator== (const counting_iterator &it) const
 
bool operator!= (const counting_iterator &it) const
 
bool operator< (const counting_iterator &it) const
 
bool operator> (const counting_iterator &it) const
 
bool operator<= (const counting_iterator &it) const
 
bool operator>= (const counting_iterator &it) const
 

Public Attributes

decltype(IntType() -IntType()) typedef difference_type
 

Private Attributes

IntType my_counter
 

Friends

counting_iterator operator+ (difference_type forward, const counting_iterator it)
 

Detailed Description

template<typename IntType>
class tbb::counting_iterator< IntType >

Definition at line 34 of file iterators.h.

Member Typedef Documentation

◆ iterator_category

template<typename IntType >
typedef std::random_access_iterator_tag tbb::counting_iterator< IntType >::iterator_category

Definition at line 40 of file iterators.h.

◆ pointer

template<typename IntType >
typedef const IntType* tbb::counting_iterator< IntType >::pointer

Definition at line 38 of file iterators.h.

◆ reference

template<typename IntType >
typedef const IntType& tbb::counting_iterator< IntType >::reference

Definition at line 39 of file iterators.h.

◆ value_type

template<typename IntType >
typedef IntType tbb::counting_iterator< IntType >::value_type

Definition at line 37 of file iterators.h.

Constructor & Destructor Documentation

◆ counting_iterator()

template<typename IntType >
tbb::counting_iterator< IntType >::counting_iterator ( IntType  init)
inlineexplicit

Definition at line 42 of file iterators.h.

42 : my_counter(init) { __TBB_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer, "Integer required."); }
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:545

References __TBB_STATIC_ASSERT.

Referenced by tbb::counting_iterator< IntType >::operator+(), and tbb::counting_iterator< IntType >::operator-().

Here is the caller graph for this function:

Member Function Documentation

◆ operator *()

template<typename IntType >
reference tbb::counting_iterator< IntType >::operator * ( ) const
inline

Definition at line 44 of file iterators.h.

44 { return my_counter; }

References tbb::counting_iterator< IntType >::my_counter.

◆ operator!=()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator!= ( const counting_iterator< IntType > &  it) const
inline

Definition at line 70 of file iterators.h.

70 { return !(*this == it); }

◆ operator+()

template<typename IntType >
counting_iterator tbb::counting_iterator< IntType >::operator+ ( difference_type  forward) const
inline

Definition at line 66 of file iterators.h.

66 { return counting_iterator(my_counter + forward); }
counting_iterator(IntType init)
Definition: iterators.h:42

References tbb::counting_iterator< IntType >::counting_iterator(), and tbb::counting_iterator< IntType >::my_counter.

Here is the call graph for this function:

◆ operator++() [1/2]

template<typename IntType >
counting_iterator& tbb::counting_iterator< IntType >::operator++ ( )
inline

Definition at line 51 of file iterators.h.

51 { return *this += 1; }

◆ operator++() [2/2]

template<typename IntType >
counting_iterator tbb::counting_iterator< IntType >::operator++ ( int  )
inline

Definition at line 54 of file iterators.h.

54  {
55  counting_iterator it(*this);
56  ++(*this);
57  return it;
58  }
counting_iterator(IntType init)
Definition: iterators.h:42

◆ operator+=()

template<typename IntType >
counting_iterator& tbb::counting_iterator< IntType >::operator+= ( difference_type  forward)
inline

Definition at line 49 of file iterators.h.

49 { my_counter += forward; return *this; }

References tbb::counting_iterator< IntType >::my_counter.

◆ operator-() [1/2]

template<typename IntType >
difference_type tbb::counting_iterator< IntType >::operator- ( const counting_iterator< IntType > &  it) const
inline

Definition at line 47 of file iterators.h.

47 { return my_counter - it.my_counter; }

References tbb::counting_iterator< IntType >::my_counter.

◆ operator-() [2/2]

template<typename IntType >
counting_iterator tbb::counting_iterator< IntType >::operator- ( difference_type  backward) const
inline

Definition at line 65 of file iterators.h.

65 { return counting_iterator(my_counter - backward); }
counting_iterator(IntType init)
Definition: iterators.h:42

References tbb::counting_iterator< IntType >::counting_iterator(), and tbb::counting_iterator< IntType >::my_counter.

Here is the call graph for this function:

◆ operator--() [1/2]

template<typename IntType >
counting_iterator& tbb::counting_iterator< IntType >::operator-- ( )
inline

Definition at line 52 of file iterators.h.

52 { return *this -= 1; }

◆ operator--() [2/2]

template<typename IntType >
counting_iterator tbb::counting_iterator< IntType >::operator-- ( int  )
inline

Definition at line 59 of file iterators.h.

59  {
60  counting_iterator it(*this);
61  --(*this);
62  return it;
63  }
counting_iterator(IntType init)
Definition: iterators.h:42

◆ operator-=()

template<typename IntType >
counting_iterator& tbb::counting_iterator< IntType >::operator-= ( difference_type  backward)
inline

Definition at line 50 of file iterators.h.

50 { return *this += -backward; }

◆ operator<()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator< ( const counting_iterator< IntType > &  it) const
inline

Definition at line 71 of file iterators.h.

71 {return *this - it < 0; }

◆ operator<=()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator<= ( const counting_iterator< IntType > &  it) const
inline

Definition at line 73 of file iterators.h.

73 { return !(*this > it); }

◆ operator==()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator== ( const counting_iterator< IntType > &  it) const
inline

Definition at line 69 of file iterators.h.

69 { return *this - it == 0; }

◆ operator>()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator> ( const counting_iterator< IntType > &  it) const
inline

Definition at line 72 of file iterators.h.

72 { return it < *this; }

◆ operator>=()

template<typename IntType >
bool tbb::counting_iterator< IntType >::operator>= ( const counting_iterator< IntType > &  it) const
inline

Definition at line 74 of file iterators.h.

74 { return !(*this < it); }

◆ operator[]()

template<typename IntType >
value_type tbb::counting_iterator< IntType >::operator[] ( difference_type  i) const
inline

Definition at line 45 of file iterators.h.

45 { return *(*this + i); }

Friends And Related Function Documentation

◆ operator+

template<typename IntType >
counting_iterator operator+ ( difference_type  forward,
const counting_iterator< IntType >  it 
)
friend

Definition at line 67 of file iterators.h.

67 { return it + forward; }

Member Data Documentation

◆ difference_type

template<typename IntType >
decltype(IntType()-IntType()) typedef tbb::counting_iterator< IntType >::difference_type

Definition at line 36 of file iterators.h.

◆ my_counter


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

Copyright © 2005-2018 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.