diff --git a/utils/result.hh b/utils/result.hh index 444a23e38e..3d0426a77f 100644 --- a/utils/result.hh +++ b/utils/result.hh @@ -59,4 +59,24 @@ concept ResultRebindableTo = template using rebind_result = bo::result; +struct result_with_exception_ptr_throw_policy : bo::policy::base { + template static constexpr void wide_value_check(Impl&& self) { + if (!base::_has_value(self)) { + std::rethrow_exception(base::_error(self)); + } + } + + template static constexpr void wide_error_check(Impl&& self) { + if (!base::_has_error(self)) { + throw bo::bad_result_access("no error"); + } + } +}; + +template +using result_with_exception_ptr = bo::result; + +template +concept ExceptionPtrResult = bo::is_basic_result::value && std::same_as; + }