tmp/tmptahs677y/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Observers <a id="expected.object.obs">[[expected.object.obs]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr const T* operator->() const noexcept;
|
| 5 |
+
constexpr T* operator->() noexcept;
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
*Preconditions:* `has_value()` is `true`.
|
| 9 |
+
|
| 10 |
+
*Returns:* `addressof(`*`val`*`)`.
|
| 11 |
+
|
| 12 |
+
``` cpp
|
| 13 |
+
constexpr const T& operator*() const & noexcept;
|
| 14 |
+
constexpr T& operator*() & noexcept;
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
*Preconditions:* `has_value()` is `true`.
|
| 18 |
+
|
| 19 |
+
*Returns:* *val*.
|
| 20 |
+
|
| 21 |
+
``` cpp
|
| 22 |
+
constexpr T&& operator*() && noexcept;
|
| 23 |
+
constexpr const T&& operator*() const && noexcept;
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
*Preconditions:* `has_value()` is `true`.
|
| 27 |
+
|
| 28 |
+
*Returns:* `std::move(`*`val`*`)`.
|
| 29 |
+
|
| 30 |
+
``` cpp
|
| 31 |
+
constexpr explicit operator bool() const noexcept;
|
| 32 |
+
constexpr bool has_value() const noexcept;
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
*Returns:* *has_val*.
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
constexpr const T& value() const &;
|
| 39 |
+
constexpr T& value() &;
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
*Mandates:* `is_copy_constructible_v<E>` is `true`.
|
| 43 |
+
|
| 44 |
+
*Returns:* *val*, if `has_value()` is `true`.
|
| 45 |
+
|
| 46 |
+
*Throws:* `bad_expected_access(as_const(error()))` if `has_value()` is
|
| 47 |
+
`false`.
|
| 48 |
+
|
| 49 |
+
``` cpp
|
| 50 |
+
constexpr T&& value() &&;
|
| 51 |
+
constexpr const T&& value() const &&;
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Mandates:* `is_copy_constructible_v<E>` is `true` and
|
| 55 |
+
`is_constructible_v<E, decltype(std::move(error()))>` is `true`.
|
| 56 |
+
|
| 57 |
+
*Returns:* `std::move(`*`val`*`)`, if `has_value()` is `true`.
|
| 58 |
+
|
| 59 |
+
*Throws:* `bad_expected_access(std::move(error()))` if `has_value()` is
|
| 60 |
+
`false`.
|
| 61 |
+
|
| 62 |
+
``` cpp
|
| 63 |
+
constexpr const E& error() const & noexcept;
|
| 64 |
+
constexpr E& error() & noexcept;
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
*Preconditions:* `has_value()` is `false`.
|
| 68 |
+
|
| 69 |
+
*Returns:* *unex*.
|
| 70 |
+
|
| 71 |
+
``` cpp
|
| 72 |
+
constexpr E&& error() && noexcept;
|
| 73 |
+
constexpr const E&& error() const && noexcept;
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
*Preconditions:* `has_value()` is `false`.
|
| 77 |
+
|
| 78 |
+
*Returns:* `std::move(`*`unex`*`)`.
|
| 79 |
+
|
| 80 |
+
``` cpp
|
| 81 |
+
template<class U> constexpr T value_or(U&& v) const &;
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
*Mandates:* `is_copy_constructible_v<T>` is `true` and
|
| 85 |
+
`is_convertible_v<U, T>` is `true`.
|
| 86 |
+
|
| 87 |
+
*Returns:* `has_value() ? **this : static_cast<T>(std::forward<U>(v))`.
|
| 88 |
+
|
| 89 |
+
``` cpp
|
| 90 |
+
template<class U> constexpr T value_or(U&& v) &&;
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
*Mandates:* `is_move_constructible_v<T>` is `true` and
|
| 94 |
+
`is_convertible_v<U, T>` is `true`.
|
| 95 |
+
|
| 96 |
+
*Returns:*
|
| 97 |
+
`has_value() ? std::move(**this) : static_cast<T>(std::forward<U>(v))`.
|
| 98 |
+
|
| 99 |
+
``` cpp
|
| 100 |
+
template<class G = E> constexpr E error_or(G&& e) const &;
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
*Mandates:* `is_copy_constructible_v<E>` is `true` and
|
| 104 |
+
`is_convertible_v<G, E>` is `true`.
|
| 105 |
+
|
| 106 |
+
*Returns:* `std::forward<G>(e)` if `has_value()` is `true`, `error()`
|
| 107 |
+
otherwise.
|
| 108 |
+
|
| 109 |
+
``` cpp
|
| 110 |
+
template<class G = E> constexpr E error_or(G&& e) &&;
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
*Mandates:* `is_move_constructible_v<E>` is `true` and
|
| 114 |
+
`is_convertible_v<G, E>` is `true`.
|
| 115 |
+
|
| 116 |
+
*Returns:* `std::forward<G>(e)` if `has_value()` is `true`,
|
| 117 |
+
`std::move(error())` otherwise.
|
| 118 |
+
|