12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef BOOST_OUTCOME_POLICY_OUTCOME_EXCEPTION_PTR_RETHROW_HPP
- #define BOOST_OUTCOME_POLICY_OUTCOME_EXCEPTION_PTR_RETHROW_HPP
- #include "result_exception_ptr_rethrow.hpp"
- BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
- namespace policy
- {
-
- template <class T, class EC, class E> struct exception_ptr_rethrow : base
- {
- template <class Impl> static constexpr void wide_value_check(Impl &&self)
- {
- if(!base::_has_value(std::forward<Impl>(self)))
- {
- if(base::_has_exception(std::forward<Impl>(self)))
- {
- detail::_rethrow_exception<trait::is_exception_ptr_available<E>::value>{base::_exception<T, EC, E, exception_ptr_rethrow>(std::forward<Impl>(self))};
- }
- if(base::_has_error(std::forward<Impl>(self)))
- {
- detail::_rethrow_exception<trait::is_exception_ptr_available<EC>::value>{base::_error(std::forward<Impl>(self))};
- }
- BOOST_OUTCOME_THROW_EXCEPTION(bad_outcome_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_outcome_access("no error"));
- }
- }
- template <class Impl> static constexpr void wide_exception_check(Impl &&self)
- {
- if(!base::_has_exception(std::forward<Impl>(self)))
- {
- BOOST_OUTCOME_THROW_EXCEPTION(bad_outcome_access("no exception"));
- }
- }
- };
- }
- BOOST_OUTCOME_V2_NAMESPACE_END
- #endif
|