forked from facebook/folly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
folly::Try: add value_or() implementations mimicking std::optional::v…
…alue_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
- Loading branch information
1 parent
d3f0a28
commit 6d8bd01
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters