HDK
|
#include <strided_ptr.h>
Public Member Functions | |
constexpr | strided_ptr (T *ptr=nullptr, ptrdiff_t stride=1) noexcept |
constexpr | strided_ptr (const strided_ptr &p) noexcept |
const strided_ptr & | operator= (const strided_ptr &p) noexcept |
const strided_ptr & | operator= (T *p) noexcept |
constexpr T & | operator* () const |
constexpr T & | operator[] (ptrdiff_t pos) const |
constexpr T * | data () const |
constexpr ptrdiff_t | stride () const |
constexpr bool | operator== (const T *p) const |
constexpr bool | operator!= (const T *p) const |
const strided_ptr & | operator++ () |
const strided_ptr | operator++ (int) |
const strided_ptr & | operator-- () |
const strided_ptr | operator-- (int) |
constexpr strided_ptr | operator+ (ptrdiff_t d) const noexcept |
constexpr strided_ptr | operator- (ptrdiff_t d) const noexcept |
const strided_ptr & | operator+= (ptrdiff_t d) noexcept |
const strided_ptr & | operator-= (ptrdiff_t d) |
strided_ptr<T> looks like a 'T*', but it incorporates a stride, so it's not limited to adjacent elements. Operators ++, –, [], and so on, take the stride into account when computing where each "array element" actually exists.
A strided_ptr<T> is mutable (the values pointed to may be modified), whereas an strided_ptr<const T> is not mutable.
Fun trick: strided_ptr<T>(&my_value,0) makes a strided_pointer that is addressed like an array, but because the stride is 0, every accessed "element" actually will actually refer to the same value.
By default, if StrideUnits == sizeof(T), then the stride refers to multiples of the size of T. But every once in a while, you need a a byte-addressable stride, and in that case you use a StrideUnits of 1, like: strided_ptr<T,1>.
Definition at line 33 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 35 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 40 of file strided_ptr.h.
|
inline |
Definition at line 62 of file strided_ptr.h.
|
inline |
Definition at line 67 of file strided_ptr.h.
|
inline |
Definition at line 60 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 96 of file strided_ptr.h.
|
inline |
Definition at line 71 of file strided_ptr.h.
|
inline |
Definition at line 76 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 104 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 100 of file strided_ptr.h.
|
inline |
Definition at line 82 of file strided_ptr.h.
|
inline |
Definition at line 87 of file strided_ptr.h.
|
inline |
Definition at line 109 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 45 of file strided_ptr.h.
|
inlinenoexcept |
Definition at line 53 of file strided_ptr.h.
|
inline |
Definition at line 66 of file strided_ptr.h.
|
inline |
Definition at line 61 of file strided_ptr.h.
|
inline |
Definition at line 63 of file strided_ptr.h.