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

#include <counting_iterator.h>

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

Classes

struct  Payload
 

Public Types

typedef boost::iterator_facade
< counting_iterator
< value_type >, value_type,
counting_iterator_tag,
value_type, int >
::difference_type 
difference_type
 
typedef counting_iterator_tag iterator_category
 
typedef
std::random_access_iterator_tag 
memory_system
 
typedef value_type * pointer
 

Public Member Functions

 counting_iterator (value_type init, const control &ctl=control::getDefault())
 
template<typename OtherType >
 counting_iterator (const counting_iterator< OtherType > &rhs)
 
value_type * getPointer ()
 
const value_type * getPointer () const
 
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 ::cl::Buffer & getBuffer () const
 
const counting_iterator
< value_type > & 
getContainer () const
 
const counting_iterator
< value_type > & 
base () const
 
Payload gpuPayload () const
 
const difference_type gpuPayloadSize () const
 
int setKernelBuffers (int arg_num,::cl::Kernel &kernel) const
 
difference_type distance_to (const counting_iterator< value_type > &rhs) const
 

Public Attributes

difference_type m_Index
 

Friends

class boost::iterator_core_access
 
template<typename >
class counting_iterator
 

Detailed Description

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

counting_iterator iterates a range with sequential values.

The following demonstrates how to use a counting_iterator.

#include <bolt/cl/counting_iterator.h>
...
std::vector<int> vecSrc( 5 );
std::vector<int> vecDest( 5 );
std::fill( vecSrc.begin( ), vecSrc.end( ), 10 );
...
bolt::cl::counting_iterator< int > count5( 5 );
bolt::cl::transform( ctrl, vecSrc.begin( ), vecSrc.end( ), count5, vecDest.begin( ), bolt::cl::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: