@@ -300,53 +300,53 @@ template <typename T> class Optional {
300
300
301
301
void reset () { Storage.reset (); }
302
302
303
- constexpr const T *getPointer () const { return &Storage.getValue (); }
304
- T *getPointer () { return &Storage.getValue (); }
305
- constexpr const T &value () const & { return Storage.getValue (); }
306
- constexpr const T &getValue () const & { return Storage.getValue (); }
307
- T &value () & { return Storage.getValue (); }
308
- T &getValue () & { return Storage.getValue (); }
303
+ constexpr const T *getPointer () const { return &Storage.value (); }
304
+ T *getPointer () { return &Storage.value (); }
305
+ constexpr const T &value () const & { return Storage.value (); }
306
+ constexpr const T &getValue () const & { return Storage.value (); }
307
+ T &value () & { return Storage.value (); }
308
+ T &getValue () & { return Storage.value (); }
309
309
310
310
constexpr explicit operator bool () const { return has_value (); }
311
311
constexpr bool has_value () const { return Storage.has_value (); }
312
312
constexpr bool hasValue () const { return Storage.has_value (); }
313
313
constexpr const T *operator ->() const { return getPointer (); }
314
314
T *operator ->() { return getPointer (); }
315
- constexpr const T &operator *() const & { return getValue (); }
316
- T &operator *() & { return getValue (); }
315
+ constexpr const T &operator *() const & { return value (); }
316
+ T &operator *() & { return value (); }
317
317
318
318
template <typename U> constexpr T value_or (U &&alt) const & {
319
- return has_value () ? getValue () : std::forward<U>(alt);
319
+ return has_value () ? value () : std::forward<U>(alt);
320
320
}
321
321
template <typename U> constexpr T getValueOr (U &&alt) const & {
322
- return has_value () ? getValue () : std::forward<U>(alt);
322
+ return has_value () ? value () : std::forward<U>(alt);
323
323
}
324
324
325
325
// / Apply a function to the value if present; otherwise return None.
326
326
template <class Function >
327
- auto map (const Function &F) const & -> Optional<decltype(F(getValue ()))> {
327
+ auto map (const Function &F) const & -> Optional<decltype(F(value ()))> {
328
328
if (*this )
329
- return F (getValue ());
329
+ return F (value ());
330
330
return None;
331
331
}
332
332
333
- T &&value() && { return std::move (Storage.getValue ()); }
334
- T &&getValue() && { return std::move (Storage.getValue ()); }
335
- T &&operator *() && { return std::move (Storage.getValue ()); }
333
+ T &&value() && { return std::move (Storage.value ()); }
334
+ T &&getValue() && { return std::move (Storage.value ()); }
335
+ T &&operator *() && { return std::move (Storage.value ()); }
336
336
337
337
template <typename U> T value_or (U &&alt) && {
338
- return has_value () ? std::move (getValue ()) : std::forward<U>(alt);
338
+ return has_value () ? std::move (value ()) : std::forward<U>(alt);
339
339
}
340
340
template <typename U> T getValueOr (U &&alt) && {
341
- return has_value () ? std::move (getValue ()) : std::forward<U>(alt);
341
+ return has_value () ? std::move (value ()) : std::forward<U>(alt);
342
342
}
343
343
344
344
// / Apply a function to the value if present; otherwise return None.
345
345
template <class Function >
346
346
auto map (const Function &F)
347
- && -> Optional<decltype(F(std::move(*this ).getValue ()))> {
347
+ && -> Optional<decltype(F(std::move(*this ).value ()))> {
348
348
if (*this )
349
- return F (std::move (*this ).getValue ());
349
+ return F (std::move (*this ).value ());
350
350
return None;
351
351
}
352
352
};
0 commit comments