mirror of
https://github.com/BlackMATov/promise.hpp.git
synced 2025-12-13 03:46:29 +07:00
fix #24 issue
This commit is contained in:
@@ -328,11 +328,12 @@ namespace promise_hpp
|
||||
return state_->get();
|
||||
}
|
||||
|
||||
const T& get_or_default(const T& def) const noexcept {
|
||||
template < typename U >
|
||||
T get_or_default(U&& def) const {
|
||||
try {
|
||||
return get();
|
||||
} catch (...) {
|
||||
return def;
|
||||
return std::forward<U>(def);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,7 +758,7 @@ namespace promise_hpp
|
||||
state_->get();
|
||||
}
|
||||
|
||||
void get_or_default() const noexcept {
|
||||
void get_or_default() const {
|
||||
try {
|
||||
return get();
|
||||
} catch (...) {
|
||||
|
||||
Reference in New Issue
Block a user