matlab::data::TypedArray<T>
Templated C++ class to access array data
Description
The templated TypedArray
class provides type-safe APIs to handle all
MATLAB array types (except sparse arrays). To create a TypedArray
, call
createArray
or createScalar
in the
ArrayFactory
class with one of the templates listed in Template Instantiations.
This class defines the following iterator types:
using iterator = TypedIterator<T>; using const_iterator = TypedIterator<T const>;
Class Details
Namespace: | matlab::data |
Base class: | matlab::data::Array |
Include: | TypedArray.hpp |
Template Parameters
|
Type of element referred to. |
Template Instantiations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matlab::data::Array |
matlab::data::Struct |
matlab::data::Enumeration |
Constructors
Copy Constructor
TypedArray(const TypedArray<T>& rhs)
TypedArray(const Array& rhs)
Creates a shared data copy of the input.
|
Value to be copied. |
|
Value specified as |
|
Type of input |
Copy Assignment Operator
TypedArray<T>& operator=(const TypedArray<T>&
rhs)
TypedArray<T>& operator=(const Array&
rhs)
Assigns a shared data copy of the input to this
TypedArray<T>
.
|
Value to be copied. |
|
Value specified as |
|
Updated instance. |
|
Type of input |
Move Constructor
TypedArray(TypedArray<T>&& rhs)
TypedArray(Array&& rhs)
Moves contents of the input to a new instance.
|
Value to be moved. |
|
Value specified as |
|
Type of input does not match. |
Move Assignment Operator
TypedArray<T>& operator=(TypedArray<T>&&
rhs)
TypedArray<T>& operator=(Array&&
rhs)
Moves the input to this TypedArray<T>
object.
|
Value to move. |
|
Updated instance. |
|
Type of input |
Destructor
virtual ~TypedArray()
Iterators
Begin Iterators
iterator begin()
const_iterator begin() const
const_iterator cbegin() const
|
Iterator to beginning of array, specified as
|
|
Iterator, specified as |
None
End Iterators
iterator end()
const_iterator end() const
const_iterator cend() const
|
Iterator to end of array, specified as
|
|
Iterator, specified as |
None
Indexing Operators
operator[]
ArrayElementTypedRef<T, std::is_const<T>::value> operator[](size_t idx)
ArrayElementTypedRef<T, true> operator[](size_t idx) const
Enables []
indexing on a TypedArray
.
Indexing is 0-based.
|
First array index. |
|
Temporary object containing index specified. If type
|
|
Temporary object containing index specified. The return value allows the element of the array to be retrieved, but not modified. |
None
Member Functions
release
buffer_ptr_t<T> release()
Release the underlying buffer from the Array.
If the Array has shared copies, the function unshares the Array from the copies. The buffer of the unshared Array contains the copied data and the default deleter. (since R2024b) Then the function releases the buffer.
If the Array does not have shared copies, the function releases the buffer.
After releasing the buffer, the Array contains no elements. For more information about sharing and unsharing copies of Array, see Copy C++ MATLAB Data Arrays.
|
|
|
|
Examples
Version History
Introduced in R2017b