1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef BOOST_OUTCOME_POLICY_RESULT_EXCEPTION_PTR_RETHROW_HPP
- #define BOOST_OUTCOME_POLICY_RESULT_EXCEPTION_PTR_RETHROW_HPP
- #include "../bad_access.hpp"
- #include "base.hpp"
- BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
- namespace policy
- {
-
- template <class T, class EC, class E> struct exception_ptr_rethrow;
- template <class T, class EC> struct exception_ptr_rethrow<T, EC, void> : base
- {
- template <class Impl> static constexpr void wide_value_check(Impl &&self)
- {
- if(!base::_has_value(std::forward<Impl>(self)))
- {
- if(base::_has_error(std::forward<Impl>(self)))
- {
-
- rethrow_exception(policy::exception_ptr(base::_error(std::forward<Impl>(self))));
- }
- BOOST_OUTCOME_THROW_EXCEPTION(bad_result_access("no value"));
- }
- }
- template <class Impl> static constexpr void wide_error_check(Impl &&self)
- {
- if(!base::_has_error(std::forward<Impl>(self)))
- {
- BOOST_OUTCOME_THROW_EXCEPTION(bad_result_access("no error"));
- }
- }
- };
- }
- BOOST_OUTCOME_V2_NAMESPACE_END
- #endif
|