C++ Utilities 5.27.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
The MultiArray class provides an N-dimensional array. More...
#include <multiarray.h>
Public Member Functions | |
MultiArray (Dimensions... dimensionSizes) | |
Constructs a new N-dimensional array. The sizes for the dimensions are passed as arguments and must be greater than zero. | |
std::size_t | totalSize () const |
Returns the total number of elements. | |
template<std::size_t index> | |
std::size_t | dimensionSize () const |
Returns the number of elements in the specified dimension. | |
T & | at (Dimensions... indices) |
Returns the element at the position specified via indices. | |
const T & | at (Dimensions... indices) const |
Returns the element at the position specified via indices. | |
T * | data () |
Returns a pointer to the raw data. | |
const T * | data () const |
Returns a pointer to the raw data. | |
UnderlyingContainer::template Type< T > & | buffer () |
Allows accessing the underlying buffer directly. | |
Static Public Member Functions | |
static constexpr std::size_t | dimensionCount () |
Returns the number of dimensions for that type of array. | |
The MultiArray class provides an N-dimensional array.
T | Specifies the type of the data the MultiArray is supposed to contain. |
UnderlyingContainer | Specifies the type of the underlying container to use. |
Dimensions | Specifies the types used to store the limit/size of the dimensions. Must be safely castable to std::size_t. |
Definition at line 76 of file multiarray.h.
CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::MultiArray | ( | Dimensions... | dimensionSizes | ) |
Constructs a new N-dimensional array. The sizes for the dimensions are passed as arguments and must be greater than zero.
Definition at line 99 of file multiarray.h.
T & CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::at | ( | Dimensions... | indices | ) |
Returns the element at the position specified via indices.
Definition at line 131 of file multiarray.h.
const T & CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::at | ( | Dimensions... | indices | ) | const |
Returns the element at the position specified via indices.
Definition at line 139 of file multiarray.h.
UnderlyingContainer::template Type< T > & CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::buffer | ( | ) |
Allows accessing the underlying buffer directly.
Definition at line 161 of file multiarray.h.
T * CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::data | ( | ) |
Returns a pointer to the raw data.
Definition at line 146 of file multiarray.h.
const T * CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::data | ( | ) | const |
Returns a pointer to the raw data.
Definition at line 153 of file multiarray.h.
|
staticconstexpr |
Returns the number of dimensions for that type of array.
Definition at line 115 of file multiarray.h.
std::size_t CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::dimensionSize | ( | ) | const |
Returns the number of elements in the specified dimension.
Definition at line 123 of file multiarray.h.
std::size_t CppUtilities::MultiArray< T, UnderlyingContainer, Dimensions >::totalSize | ( | ) | const |
Returns the total number of elements.
Definition at line 108 of file multiarray.h.