Move the error value when throwing an exception in .value rval overloads
Fixes #61
This commit is contained in:
1 parent
3d741708b9
commit
e7b1777dc8
2 files changed
+12
-3
No files matched your search
@@ -1907,14 +1907,14 @@ public:
|
||||
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
|
||||
TL_EXPECTED_11_CONSTEXPR const U &&value() const && {
|
||||
if (!has_value())
|
||||
detail::throw_exception(bad_expected_access<E>(err().value()));
|
||||
detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
|
||||
return std::move(val());
|
||||
}
|
||||
template <class U = T,
|
||||
detail::enable_if_t<!std::is_void<U>::value> * = nullptr>
|
||||
TL_EXPECTED_11_CONSTEXPR U &&value() && {
|
||||
if (!has_value())
|
||||
detail::throw_exception(bad_expected_access<E>(err().value()));
|
||||
detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
|
||||
return std::move(val());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user