array::reinterpret_as Method

Returns a one-dimensional array that contains all the elements in the array object.

template <
   typename _Value_type2                     
>
array_view<_Value_type2,1> reinterpret_as()restrict(amp,cpu);
                     
template <
   typename _Value_type2                     
>
array_view<const _Value_type2,1> reinterpret_as() const restrict(amp,cpu);

Parameters

  • _Value_type2
    The data type of the returned data.

Return Value

An array_view or const array_view object that is based on the array, with the element type reinterpreted from T to ElementType and the rank reduced from N to 1.

Remarks

Sometimes it is desirable to view the data of an N-dimensional array as a linear array, possibly with a not type safe reinterpretation of the element type. You can achieve this by using this method. The following code provides an example.

struct RGB { float r; float g; float b; };

array<RGB,3>  a = ...; 
array_view<float,1> v = a.reinterpret_as<float>(); 

assert(v.extent == 3*a.extent);

Requirements

Header: amp.h

Namespace: Concurrency

See Also

Reference

array Class