mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
add Result::unwrapOrDefault()
This commit is contained in:
parent
92e0de4dea
commit
1dc9ec41cc
1 changed files with 7 additions and 0 deletions
|
@ -196,6 +196,13 @@ namespace geode {
|
|||
return this->Base::value_or(std::forward<U>(val));
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr decltype(auto) unwrapOrDefault() && requires std::is_default_constructible_v<T> {
|
||||
return this->Base::value_or(T());
|
||||
}
|
||||
[[nodiscard]] constexpr decltype(auto) unwrapOrDefault() const& requires std::is_default_constructible_v<T> {
|
||||
return this->Base::value_or(T());
|
||||
}
|
||||
|
||||
template <class U>
|
||||
[[nodiscard]] constexpr decltype(auto) errorOr(U&& val) && {
|
||||
return this->Base::error_or(std::forward<U>(val));
|
||||
|
|
Loading…
Add table
Reference in a new issue