std::experimental::optional::operator->, std::experimental::optional::operator* - cppreference.com (original) (raw)
| constexpr const T* operator->() const; | (1) | (library fundamentals TS) |
|---|---|---|
| constexpr T* operator->(); | (1) | (library fundamentals TS) |
| constexpr const T& operator*() const&; | (2) | (library fundamentals TS) |
| constexpr T& operator*() &; | (2) | (library fundamentals TS) |
| constexpr const T&& operator*() const&&; | (2) | (library fundamentals TS) |
| constexpr T&& operator*() &&; | (2) | (library fundamentals TS) |
Accesses the contained value.
Returns a pointer to the contained value.
Returns a reference to the contained value.
The behavior is undefined if *this does not contain a value.
[edit] Parameters
(none)
[edit] Return value
Pointer or reference to the contained value.
[edit] Exceptions
Throws nothing.
[edit] Notes
This operator does not check whether the optional contains a value. If checked access is needed, value() or value_or() may be used.
[edit] Example
[edit] See also
| | returns the contained value (public member function) [edit] | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | returns the contained value if available, another value otherwise (public member function) [edit] |