![]() |
Blaze
3.6
|
Implementation of a static array with a fixed alignment.The AlignedArray class template represents a static array with a guaranteed, fixed alignment. The type of the array elements, the number of elements and the alignment of the array can be specified via the three template parameters: More...
#include <AlignedArray.h>
Public Types | |
using | ElementType = Type |
Type of the array elements. | |
using | Pointer = Type * |
Pointer to a non-constant array element. | |
using | ConstPointer = const Type * |
Pointer to a constant array element. | |
using | Reference = Type & |
Reference to a non-constant array element. | |
using | ConstReference = const Type & |
Reference to a constant array element. | |
using | Iterator = Type * |
Iterator over non-constant elements. | |
using | ConstIterator = const Type * |
Iterator over constant elements. | |
Public Member Functions | |
Constructors | |
AlignedArray () | |
The default constructor for AlignedArray. | |
template<typename... Ts> | |
constexpr | AlignedArray (const Ts &... args) |
Initialization constructor for AlignedArray. More... | |
AlignedArray (const AlignedArray &)=default | |
AlignedArray (AlignedArray &&)=default | |
Destructor | |
~AlignedArray ()=default | |
Conversion operators | |
constexpr | operator Pointer () noexcept |
Conversion operator to a pointer. More... | |
constexpr | operator ConstPointer () const noexcept |
Conversion operator to a pointer-to-const. More... | |
Data access functions | |
constexpr Reference | operator[] (size_t index) noexcept |
Subscript operator for the direct access to the array elements. More... | |
constexpr ConstReference | operator[] (size_t index) const noexcept |
Subscript operator for the direct access to the array elements. More... | |
Reference | at (size_t index) |
Checked access to the array elements. More... | |
ConstReference | at (size_t index) const |
Checked access to the array elements. More... | |
constexpr Pointer | data () noexcept |
Low-level data access to the array elements. More... | |
constexpr ConstPointer | data () const noexcept |
Low-level data access to the array elements. More... | |
constexpr Iterator | begin () noexcept |
Returns an iterator to the first element of the aligned array. More... | |
constexpr ConstIterator | begin () const noexcept |
Returns an iterator to the first element of the aligned array. More... | |
constexpr ConstIterator | cbegin () const noexcept |
Returns an iterator to the first element of the aligned array. More... | |
constexpr Iterator | end () noexcept |
Returns an iterator just past the last element of the aligned array. More... | |
constexpr ConstIterator | end () const noexcept |
Returns an iterator just past the last element of the aligned array. More... | |
constexpr ConstIterator | cend () const noexcept |
Returns an iterator just past the last element of the aligned array. More... | |
Assignment operators | |
AlignedArray & | operator= (const AlignedArray &)=default |
AlignedArray & | operator= (AlignedArray &&)=default |
Utility functions | |
constexpr size_t | size () const noexcept |
Returns the current size/dimension of the aligned array. More... | |
Implementation of a static array with a fixed alignment.
The AlignedArray class template represents a static array with a guaranteed, fixed alignment. The type of the array elements, the number of elements and the alignment of the array can be specified via the three template parameters:
The alignment of the array, which must be a power of two (i.e. 1, 2, 4, 8, ...), can either be specified explicitly via the template parameter Alignment or it is evaluated automatically based on the alignment requirements of the given data type Type. In the latter case, if T is a built-in, vectorizable data type, AlignedArray enforces an alignment of 16 or 32 bytes, depending on the active SSE/AVX level. In all other cases, no specific alignment is enforced.
AlignedArray can be used exactly like any built-in static array. It is possible to access the individual element via the subscript operator and the array can be used wherever a pointer is expected:
|
inlineexplicit |
Initialization constructor for AlignedArray.
args | Pack of initialization values. |
|
inline |
Checked access to the array elements.
index | Access index. The index has to be in the range ![]() |
std::out_of_range | Invalid array access index. |
In contrast to the subscript operator this function always performs a check of the given access index.
|
inline |
Checked access to the array elements.
index | Access index. The index has to be in the range ![]() |
std::out_of_range | Invalid array access index. |
In contrast to the subscript operator this function always performs a check of the given access index.
|
inlinenoexcept |
Returns an iterator to the first element of the aligned array.
|
inlinenoexcept |
Returns an iterator to the first element of the aligned array.
|
inlinenoexcept |
Returns an iterator to the first element of the aligned array.
|
inlinenoexcept |
Returns an iterator just past the last element of the aligned array.
|
inlinenoexcept |
Low-level data access to the array elements.
This function returns a pointer to the internal storage of the aligned array.
|
inlinenoexcept |
Low-level data access to the array elements.
This function returns a pointer to the internal storage of the aligned array.
|
inlinenoexcept |
Returns an iterator just past the last element of the aligned array.
|
inlinenoexcept |
Returns an iterator just past the last element of the aligned array.
|
inlinenoexcept |
Conversion operator to a pointer-to-const.
|
inlinenoexcept |
Conversion operator to a pointer.
|
inlinenoexcept |
Subscript operator for the direct access to the array elements.
index | Access index. The index has to be in the range ![]() |
|
inlinenoexcept |
Subscript operator for the direct access to the array elements.
index | Access index. The index has to be in the range ![]() |
|
inlinenoexcept |
Returns the current size/dimension of the aligned array.