18 #if !defined( BOLT_AMP_PERMUTATION_ITERATOR_H )
19 #define BOLT_AMP_PERMUTATION_ITERATOR_H
86 template<
typename element_type,
typename key_type >
90 typedef typename std::iterator< permutation_iterator_tag, typename element_type, int>::difference_type
95 typedef typename iterator_traits<key_type>::value_type index_type;
96 typedef concurrency::array_view< value_type > arrayview_type;
105 element_iterator ( ivalue ), key_iterator ( ikey ), m_Index( ikey.getIndex( ) ) { }
108 template<
typename OtherValType,
typename OtherKeyType >
117 key_iterator = rhs.key_iterator;
118 element_iterator = rhs.element_iterator;
120 m_Index = rhs.m_Index;
140 result.advance( -n );
144 const concurrency::array_view<int> & getBuffer(
perm_iterator itr )
const
157 return element_iterator.getIndex() - rhs.element_iterator.getIndex();
161 difference_type m_Index;
166 void advance( difference_type n ) restrict ( cpu, amp )
192 result.advance( -1 );
200 result.advance( -1 );
204 difference_type getIndex()
const
209 template<
typename OtherValue,
typename OtherKey >
212 bool sameIter = ( rhs.m_Index == m_Index );
216 template<
typename OtherValue,
typename OtherKey >
219 bool sameIter = ( rhs.m_Index != m_Index );
223 template<
typename OtherValue,
typename OtherKey >
224 bool operator< ( const permutation_iterator< OtherValue, OtherKey >& rhs )
const
226 bool sameIndex = (m_Index < rhs.m_Index);
232 value_type& operator*()
const restrict(cpu,amp)
234 index_type temp_index = key_iterator[m_Index];
235 return element_iterator[temp_index];
238 value_type& operator[](
int x) restrict(cpu,amp)
240 index_type temp_index = key_iterator[x];
241 return element_iterator[temp_index];
244 value_type& operator[](
int x)
const restrict(cpu,amp)
246 index_type temp_index = key_iterator[x];
247 return element_iterator[temp_index];
250 key_type key_iterator;
251 element_type element_iterator;
255 template<
typename valueType,
typename keyType >