Bolt  1.3
C++ template library with support for OpenCL
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
bolt::amp::counting_iterator< value_type > Class Template Reference

#include <counting_iterator.h>

Inheritance diagram for bolt::amp::counting_iterator< value_type >:

Public Types

typedef std::iterator
< counting_iterator_tag,
typename value_type, int >
::difference_type 
difference_type
 
typedef
concurrency::array_view
< value_type > 
arrayview_type
 
typedef counting_iterator
< value_type > 
const_iterator
 

Public Member Functions

 counting_iterator (value_type init, const control &ctl=control::getDefault())
 
template<typename OtherType >
 counting_iterator (const counting_iterator< OtherType > &rhs)
 
counting_iterator< value_type > & operator= (const counting_iterator< value_type > &rhs)
 
counting_iterator< value_type > & operator+= (const difference_type &n)
 
const counting_iterator
< value_type > 
operator+ (const difference_type &n) const
 
const counting_iterator
< value_type > 
operator- (const difference_type &n) const
 
const counting_iterator
< value_type > & 
getBuffer (const_iterator itr) const
 
value_type * getPointer ()
 
const value_type * getPointer () const
 
const counting_iterator
< value_type > & 
getContainer () const
 
difference_type operator- (const counting_iterator< value_type > &rhs) const
 
void advance (difference_type n)
 
counting_iterator< value_type > operator++ ()
 
counting_iterator< value_type > operator++ (int)
 
counting_iterator< value_type > operator-- ()
 
counting_iterator< value_type > operator-- (int)
 
difference_type getIndex () const
 
template<typename OtherType >
bool operator== (const counting_iterator< OtherType > &rhs) const
 
template<typename OtherType >
bool operator!= (const counting_iterator< OtherType > &rhs) const
 
template<typename OtherType >
bool operator< (const counting_iterator< OtherType > &rhs) const
 
value_type operator* () const restrict(cpu
 
value_type operator[] (int x) const restrict(cpu
 

Public Attributes

difference_type m_Index
 
value_type amp
 
return xy
 
return temp
 

Friends

template<typename >
class counting_iterator
 

Detailed Description

template<typename value_type>
class bolt::amp::counting_iterator< value_type >

counting_iterator iterates a range with sequential values.

The following example demonstrates how to use a counting_iterator.

#include <bolt/amp/counting_iterator.h>
...
std::vector<int> vecSrc( 5 );
std::vector<int> vecDest( 5 );
std::fill( vecSrc.begin( ), vecSrc.end( ), 10 );
...
bolt::amp::counting_iterator< int > count5( 5 );
bolt::amp::transform( ctrl, vecSrc.begin( ), vecSrc.end( ), count5, vecDest.begin( ), bolt::amp::plus< int >( ) );
// Output:
// vecDest = { 15, 16, 17, 18, 19 }
// counting_iterator can save bandwidth when used instead of a range of values.

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