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

#include <constant_iterator.h>

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

Classes

struct  Payload
 

Public Types

typedef std::iterator
< constant_iterator_tag,
typename value_type, int >
::difference_type 
difference_type
 
typedef
concurrency::array_view
< value_type > 
arrayview_type
 
typedef constant_iterator
< value_type > 
const_iterator
 

Public Member Functions

 constant_iterator (value_type init, const control &ctl=control::getDefault())
 
template<typename OtherType >
 constant_iterator (const constant_iterator< OtherType > &rhs)
 
constant_iterator< value_type > & operator= (const constant_iterator< value_type > &rhs)
 
constant_iterator< value_type > & operator+= (const difference_type &n)
 
const constant_iterator
< value_type > 
operator+ (const difference_type &n) const
 
const constant_iterator
< value_type > 
operator- (const difference_type &n) const
 
const constant_iterator
< value_type > & 
getBuffer (const_iterator itr) const
 
const constant_iterator
< value_type > & 
getContainer () const
 
difference_type operator- (const constant_iterator< value_type > &rhs) const
 
void advance (difference_type n)
 
value_type * getPointer ()
 
const value_type * getPointer () const
 
constant_iterator< value_type > operator++ ()
 
constant_iterator< value_type > operator++ (int) const
 
constant_iterator< value_type > operator-- () const
 
constant_iterator< value_type > operator-- (int) const
 
difference_type getIndex () const
 
template<typename OtherType >
bool operator== (const constant_iterator< OtherType > &rhs) const
 
template<typename OtherType >
bool operator!= (const constant_iterator< OtherType > &rhs) const
 
template<typename OtherType >
bool operator< (const constant_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
 

Friends

template<typename >
class constant_iterator
 

Detailed Description

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

constant_iterator iterates a range with a constant value.

The following example demonstrates how to use a constant_iterator.

#include <bolt/amp/constant_iterator.h>
...
std::vector<int> vecSrc( 5 );
std::vector<int> vecDest( 5 );
std::fill( vecSrc.begin( ), vecSrc.end( ), 10 );
...
bolt::amp::constant_iterator< int > const5( 5 );
bolt::amp::transform( ctrl, vecSrc.begin( ), vecSrc.end( ), const5, vecDest.begin( ), bolt::amp::plus< int >( ) );
// vecDest is vector filled with the value 15, the sum of vecSrc and the constant value 5 from the iterator
// constant_iterator can save bandwidth when used instead of a range of values.

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