C++ base class for all array types
Use Array
objects to represent single and multi-dimensional arrays. The
Array
class provides methods to get generic information about all
arrays, such as dimensions and type. The class has methods to create both deep (cloned)
copies and shared data copies and supports copy-on-write semantics.
To construct Array
objects, use ArrayFactory
methods.
Namespace: | matlab::data |
Include: | MDArray.hpp |
Array()
None
Array(const Array& rhs)
Creates a shared data copy of an Array
object.
|
Value to copy. |
None
Array& operator=(const Array& rhs)
Assigns a shared data copy to an Array
object.
|
Value to copy. |
|
Updated instance. |
None
Array(Array&& rhs)
Moves contents of an Array
object to a new instance.
|
Value to move. |
None
Array& operator=(Array&& rhs)
Assigns the input to this Array
object.
|
Value to move. |
|
Updated instance. |
None
virtual ~Array()
operator[]
ArrayElementRef<false> operator[](size_t idx)
ArrayElementRef<true> operator[](size_t idx)
const
Enables []
indexing on const
and
non-const
arrays. Indexing is 0-based.
|
First array index |
|
Temporary object containing the index specified. The return value allows the element of the array to be modified or retrieved. |
|
Temporary object containing the index specified. The return value allows the element of the array to be retrieved, but not modified. |
None
getType
ArrayType getType() const
|
Array type. |
None
MemoryLayout getMemoryLayout() const
| Memory layout for array, specified as
|
| Invalid memory layout. |
getDimensions
ArrayDimensions getDimensions() const
|
Vector of each dimension in array. |
None
getNumberOfElements
size_t getNumberOfElements() const
|
The number of elements in array. |
None
isEmpty
bool isEmpty() const
|
True if array is empty. False if array is not empty. |
None
getReadOnlyElements
template <typename T> Range<TypedIterator, T const> getReadOnlyElements(const Array& arr)
Get a range containing the elements of the Array
. Iterators
contained in the range are const
.
|
|
|
Range containing |
|
|
getWritableElements
template <typename T> Range<TypedIterator, T> getWritableElements(Array& arr)
Get a range containing the elements of the Array
. Iterators
contained in the range are non-const
.
|
|
|
Range containing |
|
|