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