@@ -92,29 +92,33 @@ class OptionalStorage {
9292 }
9393
9494 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+ }
9699
97100 T &value () &noexcept {
98101 assert (hasVal);
99102 return val;
100103 }
101- T &getValue () &noexcept {
104+ [[deprecated( " Use value instead. " )]] T &getValue () &noexcept {
102105 assert (hasVal);
103106 return val;
104107 }
105108 constexpr T const &value () const &noexcept {
106109 assert (hasVal);
107110 return val;
108111 }
109- constexpr T const &getValue () const &noexcept {
112+ [[deprecated(" Use value instead." )]] constexpr T const &
113+ getValue () const &noexcept {
110114 assert (hasVal);
111115 return val;
112116 }
113117 T &&value() &&noexcept {
114118 assert (hasVal);
115119 return std::move (val);
116120 }
117- T &&getValue() &&noexcept {
121+ [[deprecated( " Use value instead. " )]] T &&getValue() &&noexcept {
118122 assert (hasVal);
119123 return std::move (val);
120124 }
@@ -203,29 +207,33 @@ template <typename T> class OptionalStorage<T, true> {
203207 }
204208
205209 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+ }
207214
208215 T &value () &noexcept {
209216 assert (hasVal);
210217 return val;
211218 }
212- T &getValue () &noexcept {
219+ [[deprecated( " Use value instead. " )]] T &getValue () &noexcept {
213220 assert (hasVal);
214221 return val;
215222 }
216223 constexpr T const &value () const &noexcept {
217224 assert (hasVal);
218225 return val;
219226 }
220- constexpr T const &getValue () const &noexcept {
227+ [[deprecated(" Use value instead." )]] constexpr T const &
228+ getValue () const &noexcept {
221229 assert (hasVal);
222230 return val;
223231 }
224232 T &&value() &&noexcept {
225233 assert (hasVal);
226234 return std::move (val);
227235 }
228- T &&getValue() &&noexcept {
236+ [[deprecated( " Use value instead. " )]] T &&getValue() &&noexcept {
229237 assert (hasVal);
230238 return std::move (val);
231239 }
@@ -303,13 +311,19 @@ template <typename T> class Optional {
303311 constexpr const T *getPointer () const { return &Storage.value (); }
304312 T *getPointer () { return &Storage.value (); }
305313 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+ }
307317 T &value () & { return Storage.value (); }
308- T &getValue () & { return Storage.value (); }
318+ [[deprecated(" Use value instead." )]] T &getValue () & {
319+ return Storage.value ();
320+ }
309321
310322 constexpr explicit operator bool () const { return has_value (); }
311323 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+ }
313327 constexpr const T *operator ->() const { return getPointer (); }
314328 T *operator ->() { return getPointer (); }
315329 constexpr const T &operator *() const & { return value (); }
@@ -333,7 +347,9 @@ template <typename T> class Optional {
333347 }
334348
335349 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+ }
337353 T &&operator *() && { return std::move (Storage.value ()); }
338354
339355 template <typename U> T value_or (U &&alt) && {
0 commit comments