@@ -92,29 +92,33 @@ class OptionalStorage {
92
92
}
93
93
94
94
constexpr bool has_value () const noexcept { return hasVal; }
95
- constexpr bool hasValue () const noexcept { return hasVal; }
95
+ [[deprecated(" Use has_value instead." )]] constexpr bool
96
+ hasValue () const noexcept {
97
+ return hasVal;
98
+ }
96
99
97
100
T &value () &noexcept {
98
101
assert (hasVal);
99
102
return val;
100
103
}
101
- T &getValue () &noexcept {
104
+ [[deprecated( " Use value instead. " )]] T &getValue () &noexcept {
102
105
assert (hasVal);
103
106
return val;
104
107
}
105
108
constexpr T const &value () const &noexcept {
106
109
assert (hasVal);
107
110
return val;
108
111
}
109
- constexpr T const &getValue () const &noexcept {
112
+ [[deprecated(" Use value instead." )]] constexpr T const &
113
+ getValue () const &noexcept {
110
114
assert (hasVal);
111
115
return val;
112
116
}
113
117
T &&value() &&noexcept {
114
118
assert (hasVal);
115
119
return std::move (val);
116
120
}
117
- T &&getValue() &&noexcept {
121
+ [[deprecated( " Use value instead. " )]] T &&getValue() &&noexcept {
118
122
assert (hasVal);
119
123
return std::move (val);
120
124
}
@@ -203,29 +207,33 @@ template <typename T> class OptionalStorage<T, true> {
203
207
}
204
208
205
209
constexpr bool has_value () const noexcept { return hasVal; }
206
- constexpr bool hasValue () const noexcept { return hasVal; }
210
+ [[deprecated(" Use has_value instead." )]] constexpr bool
211
+ hasValue () const noexcept {
212
+ return hasVal;
213
+ }
207
214
208
215
T &value () &noexcept {
209
216
assert (hasVal);
210
217
return val;
211
218
}
212
- T &getValue () &noexcept {
219
+ [[deprecated( " Use value instead. " )]] T &getValue () &noexcept {
213
220
assert (hasVal);
214
221
return val;
215
222
}
216
223
constexpr T const &value () const &noexcept {
217
224
assert (hasVal);
218
225
return val;
219
226
}
220
- constexpr T const &getValue () const &noexcept {
227
+ [[deprecated(" Use value instead." )]] constexpr T const &
228
+ getValue () const &noexcept {
221
229
assert (hasVal);
222
230
return val;
223
231
}
224
232
T &&value() &&noexcept {
225
233
assert (hasVal);
226
234
return std::move (val);
227
235
}
228
- T &&getValue() &&noexcept {
236
+ [[deprecated( " Use value instead. " )]] T &&getValue() &&noexcept {
229
237
assert (hasVal);
230
238
return std::move (val);
231
239
}
@@ -303,13 +311,19 @@ template <typename T> class Optional {
303
311
constexpr const T *getPointer () const { return &Storage.value (); }
304
312
T *getPointer () { return &Storage.value (); }
305
313
constexpr const T &value () const & { return Storage.value (); }
306
- constexpr const T &getValue () const & { return Storage.value (); }
314
+ [[deprecated(" Use value instead." )]] constexpr const T &getValue () const & {
315
+ return Storage.value ();
316
+ }
307
317
T &value () & { return Storage.value (); }
308
- T &getValue () & { return Storage.value (); }
318
+ [[deprecated(" Use value instead." )]] T &getValue () & {
319
+ return Storage.value ();
320
+ }
309
321
310
322
constexpr explicit operator bool () const { return has_value (); }
311
323
constexpr bool has_value () const { return Storage.has_value (); }
312
- constexpr bool hasValue () const { return Storage.has_value (); }
324
+ [[deprecated(" Use has_value instead." )]] constexpr bool hasValue () const {
325
+ return Storage.has_value ();
326
+ }
313
327
constexpr const T *operator ->() const { return getPointer (); }
314
328
T *operator ->() { return getPointer (); }
315
329
constexpr const T &operator *() const & { return value (); }
@@ -333,7 +347,9 @@ template <typename T> class Optional {
333
347
}
334
348
335
349
T &&value() && { return std::move (Storage.value ()); }
336
- T &&getValue() && { return std::move (Storage.value ()); }
350
+ [[deprecated(" Use value instead." )]] T &&getValue() && {
351
+ return std::move (Storage.value ());
352
+ }
337
353
T &&operator *() && { return std::move (Storage.value ()); }
338
354
339
355
template <typename U> T value_or (U &&alt) && {
0 commit comments