Templated C++ class representing optional values
Use optional
objects to represent values that might or might not
exist.
Namespace: | matlab::data |
Include: |
|
|
Array type, specified as
|
optional()
optional(const optional& other)
Creates a shared data copy.
|
Value to copy. |
None
optional<T>& operator=(const optional<T>& other)
Assigns a shared data copy.
|
Value to copy. |
|
Updated instance. |
None
optional(optional&& other)
optional(T&& value)
Moves contents of an optional
object to a new instance.
|
Value to move. |
| Value of type T to move. |
None
optional<T>& operator=(optional<T>&& other)
optional<T>& operator=(T&& value)
Assigns the input to this instance.
|
Value to move. |
|
Updated instance. |
None
operator=
optional<T>& operator=(nullopt_t)
optional<T>& operator=(const optional<T>& other)
optional<T>& operator=(optional<T>&& other)
optional<T>& operator=(T&& value)
optional<T>& operator=(const T& value)
Assignment operators.
|
Updated instance. |
None
operator->
const T* operator->() const
T* operator->()
|
Pointer to the element. |
|
|
operator*
const T& operator*() const
T& operator*()
| Reference to the element. |
|
|
operator T
operator T() const
Cast optional<T>
value to T
.
|
Value contained in |
|
There is no value. |
bool
explicit operator bool() const
Check whether object contains a value.
|
True, if object contains a value. |
None
has_value
bool has_value() const
Check whether object contains a value.
|
True, if object contains a value. |
None
swap
void swap(optional &other)
Swap value of this optional instance with value contained in the parameter.
|
Value to swap. |
None
reset
void reset()
Reset optional value to missing
None