![]() |
ezEngine Release 25.08
|
This class encapsulates an array and it's size. It is recommended to use this class instead of plain C arrays. More...
#include <ArrayPtr.h>
Public Types | |
| using | ByteType = typename ezArrayPtrDetail::ByteTypeHelper< T >::type |
| using | ValueType = T |
| using | PointerType = T * |
| using | const_iterator = const T * |
| using | const_reverse_iterator = const_reverse_pointer_iterator< T > |
| using | iterator = T * |
| using | reverse_iterator = reverse_pointer_iterator< T > |
Public Member Functions | |
| EZ_DECLARE_POD_TYPE () | |
| EZ_ALWAYS_INLINE | ezArrayPtr () |
| Initializes the ezArrayPtr to be empty. | |
| EZ_ALWAYS_INLINE | ezArrayPtr (const ezArrayPtr< T > &other) |
| Copies the pointer and size of /a other. Does not allocate any data. | |
| ezArrayPtr (T *pPtr, ezUInt32 uiCount) | |
| Initializes the ezArrayPtr with the given pointer and number of elements. No memory is allocated or copied. | |
| template<size_t N> | |
| EZ_ALWAYS_INLINE | ezArrayPtr (T(&staticArray)[N]) |
| Initializes the ezArrayPtr to encapsulate the given array. | |
| template<typename U > | |
| EZ_ALWAYS_INLINE | ezArrayPtr (const ezArrayPtr< U > &other) |
| Initializes the ezArrayPtr to be a copy of other. No memory is allocated or copied. | |
| operator ezArrayPtr< const T > () const | |
| Convert to const version. | |
| EZ_ALWAYS_INLINE void | operator= (const ezArrayPtr< T > &other) |
| Copies the pointer and size of /a other. Does not allocate any data. | |
| EZ_ALWAYS_INLINE void | Clear () |
| Clears the array. | |
| EZ_ALWAYS_INLINE void | operator= (std::nullptr_t) |
| EZ_ALWAYS_INLINE PointerType | GetPtr () const |
| Returns the pointer to the array. | |
| EZ_ALWAYS_INLINE PointerType | GetPtr () |
| Returns the pointer to the array. | |
| EZ_ALWAYS_INLINE PointerType | GetEndPtr () |
| Returns the pointer behind the last element of the array. | |
| EZ_ALWAYS_INLINE PointerType | GetEndPtr () const |
| Returns the pointer behind the last element of the array. | |
| EZ_ALWAYS_INLINE bool | IsEmpty () const |
| Returns whether the array is empty. | |
| EZ_ALWAYS_INLINE ezUInt32 | GetCount () const |
| Returns the number of elements in the array. | |
| EZ_FORCE_INLINE ezArrayPtr< T > | GetSubArray (ezUInt32 uiStart, ezUInt32 uiCount) const |
| Creates a sub-array from this array. | |
| EZ_FORCE_INLINE ezArrayPtr< T > | GetSubArray (ezUInt32 uiStart) const |
| Creates a sub-array from this array. | |
| EZ_ALWAYS_INLINE ezArrayPtr< const ByteType > | ToByteArray () const |
| Reinterprets this array as a byte array. | |
| EZ_ALWAYS_INLINE ezArrayPtr< ByteType > | ToByteArray () |
| Reinterprets this array as a byte array. | |
| template<typename U > | |
| EZ_ALWAYS_INLINE ezArrayPtr< U > | Cast () |
| Cast an ArrayPtr to an ArrayPtr to a different, but same size, type. | |
| template<typename U > | |
| EZ_ALWAYS_INLINE ezArrayPtr< const U > | Cast () const |
| Cast an ArrayPtr to an ArrayPtr to a different, but same size, type. | |
| EZ_FORCE_INLINE const ValueType & | operator[] (ezUInt32 uiIndex) const |
| Index access. | |
| EZ_FORCE_INLINE ValueType & | operator[] (ezUInt32 uiIndex) |
| Index access. | |
| template<typename = typename std::enable_if<std::is_const<T>::value == false>> | |
| bool | operator== (const ezArrayPtr< const T > &other) const |
| Compares the two arrays for equality. | |
| bool | operator== (const ezArrayPtr< T > &other) const |
| Compares the two arrays for equality. | |
| EZ_ADD_DEFAULT_OPERATOR_NOTEQUAL (const ezArrayPtr< T > &) | |
| bool | operator< (const ezArrayPtr< const T > &other) const |
| Compares the two arrays for less. | |
| void | CopyFrom (const ezArrayPtr< const T > &other) |
| Copies the data from other into this array. The arrays must have the exact same size. | |
| EZ_ALWAYS_INLINE void | Swap (ezArrayPtr< T > &other) |
| EZ_ALWAYS_INLINE bool | Contains (const T &value) const |
| Checks whether the given value can be found in the array. O(n) complexity. | |
| ezUInt32 | IndexOf (const T &value, ezUInt32 uiStartIndex=0) const |
| Searches for the first occurrence of the given value and returns its index or ezInvalidIndex if not found. | |
| ezUInt32 | LastIndexOf (const T &value, ezUInt32 uiStartIndex=ezInvalidIndex) const |
| Searches for the last occurrence of the given value and returns its index or ezInvalidIndex if not found. | |
This class encapsulates an array and it's size. It is recommended to use this class instead of plain C arrays.
No data is deallocated at destruction, the ezArrayPtr only allows for easier access.
|
inline |
Creates a sub-array from this array.