folly::Try: add value_or() implementations mimicking std::optional::value_or API
Summary: Add API equivalent to `std::optional::value_or`: https://en.cppreference.com/w/cpp/utility/optional/value_or Returns the contained value if *this has a value, otherwise returns default_value. template< class U > constexpr T value_or( U&& default_value ) const&; Equivalent to `bool(*this) ? **this : static_cast<T>(std::forward<U>(default_value))` template< class U > constexpr T value_or( U&& default_value ) &&; Equivalent to `bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(default_value))` Reviewed By: yfeldblum Differential Revision: D27346319 fbshipit-source-id: 598b740cb9068cffb0cc0fbda3579e64fd125e8b
Showing
Please register or sign in to comment