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
|
|
|
|
|
|
|
|
| 1 |
+
#### Constructors <a id="optional.ctor">[[optional.ctor]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr optional() noexcept;
|
| 5 |
+
constexpr optional(nullopt_t) noexcept;
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
*Postconditions:* `*this` does not contain a value.
|
| 9 |
+
|
| 10 |
+
*Remarks:* No contained value is initialized. For every object type `T`
|
| 11 |
+
these constructors shall be constexpr constructors ([[dcl.constexpr]]).
|
| 12 |
+
|
| 13 |
+
``` cpp
|
| 14 |
+
constexpr optional(const optional& rhs);
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
*Effects:* If `rhs` contains a value, initializes the contained value as
|
| 18 |
+
if direct-non-list-initializing an object of type `T` with the
|
| 19 |
+
expression `*rhs`.
|
| 20 |
+
|
| 21 |
+
*Postconditions:* `bool(rhs) == bool(*this)`.
|
| 22 |
+
|
| 23 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 24 |
+
|
| 25 |
+
*Remarks:* This constructor shall be defined as deleted unless
|
| 26 |
+
`is_copy_constructible_v<T>` is `true`. If
|
| 27 |
+
`is_trivially_copy_constructible_v<T>` is `true`, this constructor shall
|
| 28 |
+
be a `constexpr` constructor.
|
| 29 |
+
|
| 30 |
+
``` cpp
|
| 31 |
+
constexpr optional(optional&& rhs) noexcept(see below);
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
*Effects:* If `rhs` contains a value, initializes the contained value as
|
| 35 |
+
if direct-non-list-initializing an object of type `T` with the
|
| 36 |
+
expression `std::move(*rhs)`. `bool(rhs)` is unchanged.
|
| 37 |
+
|
| 38 |
+
*Postconditions:* `bool(rhs) == bool(*this)`.
|
| 39 |
+
|
| 40 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 41 |
+
|
| 42 |
+
*Remarks:* The expression inside `noexcept` is equivalent to
|
| 43 |
+
`is_nothrow_move_constructible_v<T>`. This constructor shall not
|
| 44 |
+
participate in overload resolution unless `is_move_constructible_v<T>`
|
| 45 |
+
is `true`. If `is_trivially_move_constructible_v<T>` is `true`, this
|
| 46 |
+
constructor shall be a `constexpr` constructor.
|
| 47 |
+
|
| 48 |
+
``` cpp
|
| 49 |
+
template <class... Args> constexpr explicit optional(in_place_t, Args&&... args);
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
*Effects:* Initializes the contained value as if
|
| 53 |
+
direct-non-list-initializing an object of type `T` with the arguments
|
| 54 |
+
`std::forward<Args>(args)...`.
|
| 55 |
+
|
| 56 |
+
*Postconditions:* `*this` contains a value.
|
| 57 |
+
|
| 58 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 59 |
+
|
| 60 |
+
*Remarks:* If `T`’s constructor selected for the initialization is a
|
| 61 |
+
constexpr constructor, this constructor shall be a constexpr
|
| 62 |
+
constructor. This constructor shall not participate in overload
|
| 63 |
+
resolution unless `is_constructible_v<T, Args...>` is `true`.
|
| 64 |
+
|
| 65 |
+
``` cpp
|
| 66 |
+
template <class U, class... Args>
|
| 67 |
+
constexpr explicit optional(in_place_t, initializer_list<U> il, Args&&... args);
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
*Effects:* Initializes the contained value as if
|
| 71 |
+
direct-non-list-initializing an object of type `T` with the arguments
|
| 72 |
+
`il, std::forward<Args>(args)...`.
|
| 73 |
+
|
| 74 |
+
*Postconditions:* `*this` contains a value.
|
| 75 |
+
|
| 76 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 77 |
+
|
| 78 |
+
*Remarks:* This constructor shall not participate in overload resolution
|
| 79 |
+
unless `is_constructible_v<T, initializer_list<U>&, Args&&...>` is
|
| 80 |
+
`true`. If `T`’s constructor selected for the initialization is a
|
| 81 |
+
constexpr constructor, this constructor shall be a constexpr
|
| 82 |
+
constructor.
|
| 83 |
+
|
| 84 |
+
[*Note 1*: The following constructors are conditionally specified as
|
| 85 |
+
explicit. This is typically implemented by declaring two such
|
| 86 |
+
constructors, of which at most one participates in overload
|
| 87 |
+
resolution. — *end note*]
|
| 88 |
+
|
| 89 |
+
``` cpp
|
| 90 |
+
template <class U = T> \EXPLICIT constexpr optional(U&& v);
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
*Effects:* Initializes the contained value as if
|
| 94 |
+
direct-non-list-initializing an object of type `T` with the expression
|
| 95 |
+
`std::forward<U>(v)`.
|
| 96 |
+
|
| 97 |
+
*Postconditions:* `*this` contains a value.
|
| 98 |
+
|
| 99 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 100 |
+
|
| 101 |
+
*Remarks:* If `T`’s selected constructor is a constexpr constructor,
|
| 102 |
+
this constructor shall be a constexpr constructor. This constructor
|
| 103 |
+
shall not participate in overload resolution unless
|
| 104 |
+
`is_constructible_v<T, U&&>` is `true`,
|
| 105 |
+
`is_same_v<decay_t<U>, in_place_t>` is `false`, and
|
| 106 |
+
`is_same_v<optional<T>, decay_t<U>>` is `false`. The constructor is
|
| 107 |
+
explicit if and only if `is_convertible_v<U&&, T>` is `false`.
|
| 108 |
+
|
| 109 |
+
``` cpp
|
| 110 |
+
template <class U> \EXPLICIT optional(const optional<U>& rhs);
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
*Effects:* If `rhs` contains a value, initializes the contained value as
|
| 114 |
+
if direct-non-list-initializing an object of type `T` with the
|
| 115 |
+
expression `*rhs`.
|
| 116 |
+
|
| 117 |
+
*Postconditions:* `bool(rhs)` == `bool(*this)`.
|
| 118 |
+
|
| 119 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 120 |
+
|
| 121 |
+
*Remarks:* This constructor shall not participate in overload resolution
|
| 122 |
+
unless
|
| 123 |
+
|
| 124 |
+
- `is_constructible_v<T, const U&>` is `true`,
|
| 125 |
+
- `is_constructible_v<T, optional<U>&>` is `false`,
|
| 126 |
+
- `is_constructible_v<T, optional<U>&&>` is `false`,
|
| 127 |
+
- `is_constructible_v<T, const optional<U>&>` is `false`,
|
| 128 |
+
- `is_constructible_v<T, const optional<U>&&>` is `false`,
|
| 129 |
+
- `is_convertible_v<optional<U>&, T>` is `false`,
|
| 130 |
+
- `is_convertible_v<optional<U>&&, T>` is `false`,
|
| 131 |
+
- `is_convertible_v<const optional<U>&, T>` is `false`, and
|
| 132 |
+
- `is_convertible_v<const optional<U>&&, T>` is `false`.
|
| 133 |
+
|
| 134 |
+
The constructor is explicit if and only if
|
| 135 |
+
`is_convertible_v<const U&, T>` is `false`.
|
| 136 |
+
|
| 137 |
+
``` cpp
|
| 138 |
+
template <class U> \EXPLICIT optional(optional<U>&& rhs);
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
*Effects:* If `rhs` contains a value, initializes the contained value as
|
| 142 |
+
if direct-non-list-initializing an object of type `T` with the
|
| 143 |
+
expression `std::move(*rhs)`. `bool(rhs)` is unchanged.
|
| 144 |
+
|
| 145 |
+
*Postconditions:* `bool(rhs)` == `bool(*this)`.
|
| 146 |
+
|
| 147 |
+
*Throws:* Any exception thrown by the selected constructor of `T`.
|
| 148 |
+
|
| 149 |
+
*Remarks:* This constructor shall not participate in overload resolution
|
| 150 |
+
unless
|
| 151 |
+
|
| 152 |
+
- `is_constructible_v<T, U&&>` is true,
|
| 153 |
+
- `is_constructible_v<T, optional<U>&>` is `false`,
|
| 154 |
+
- `is_constructible_v<T, optional<U>&&>` is `false`,
|
| 155 |
+
- `is_constructible_v<T, const optional<U>&>` is `false`,
|
| 156 |
+
- `is_constructible_v<T, const optional<U>&&>` is `false`,
|
| 157 |
+
- `is_convertible_v<optional<U>&, T>` is `false`,
|
| 158 |
+
- `is_convertible_v<optional<U>&&, T>` is `false`,
|
| 159 |
+
- `is_convertible_v<const optional<U>&, T>` is `false`, and
|
| 160 |
+
- `is_convertible_v<const optional<U>&&, T>` is `false`.
|
| 161 |
+
|
| 162 |
+
The constructor is explicit if and only if `is_convertible_v<U&&, T>` is
|
| 163 |
+
`false`.
|
| 164 |
+
|