tmp/tmp9siyuzt4/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Observers <a id="optional.ref.observe">[[optional.ref.observe]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr T* operator->() const noexcept;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
`has_value()` is `true`.
|
| 8 |
+
|
| 9 |
+
*Returns:* *val*.
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
constexpr T& operator*() const noexcept;
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
`has_value()` is `true`.
|
| 16 |
+
|
| 17 |
+
*Returns:* `*`*`val`*.
|
| 18 |
+
|
| 19 |
+
``` cpp
|
| 20 |
+
constexpr explicit operator bool() const noexcept;
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
*Returns:* *`val`*` != nullptr`.
|
| 24 |
+
|
| 25 |
+
``` cpp
|
| 26 |
+
constexpr bool has_value() const noexcept;
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
*Returns:* *`val`*` != nullptr`.
|
| 30 |
+
|
| 31 |
+
``` cpp
|
| 32 |
+
constexpr T& value() const;
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
*Effects:* Equivalent to:
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
return has_value() ? *val : throw bad_optional_access();
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
``` cpp
|
| 42 |
+
template<class U = remove_cv_t<T>> constexpr remove_cv_t<T> value_or(U&& u) const;
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
Let `X` be `remove_cv_t<T>`.
|
| 46 |
+
|
| 47 |
+
*Mandates:* `is_constructible_v<X, T&> && is_convertible_v<U, X>` is
|
| 48 |
+
`true`.
|
| 49 |
+
|
| 50 |
+
*Effects:* Equivalent to:
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
return has_value() ? *val : static_cast<X>(std::forward<U>(u));
|
| 54 |
+
```
|
| 55 |
+
|