123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #ifndef BOOST_OUTCOME_BASIC_OUTCOME_EXCEPTION_OBSERVERS_HPP
- #define BOOST_OUTCOME_BASIC_OUTCOME_EXCEPTION_OBSERVERS_HPP
- #include "basic_result_storage.hpp"
- BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
- namespace detail
- {
- template <class Base, class R, class S, class P, class NoValuePolicy> class basic_outcome_exception_observers : public Base
- {
- public:
- using exception_type = P;
- using Base::Base;
- constexpr inline exception_type &assume_exception() & noexcept;
- constexpr inline const exception_type &assume_exception() const & noexcept;
- constexpr inline exception_type &&assume_exception() && noexcept;
- constexpr inline const exception_type &&assume_exception() const && noexcept;
- constexpr inline exception_type &exception() &;
- constexpr inline const exception_type &exception() const &;
- constexpr inline exception_type &&exception() &&;
- constexpr inline const exception_type &&exception() const &&;
- };
-
- template <class Base, class R, class S, class NoValuePolicy> class basic_outcome_exception_observers<Base, R, S, void, NoValuePolicy> : public Base
- {
- public:
- using Base::Base;
- constexpr void assume_exception() & noexcept { NoValuePolicy::narrow_exception_check(*this); }
- constexpr void assume_exception() const & noexcept { NoValuePolicy::narrow_exception_check(*this); }
- constexpr void assume_exception() && noexcept { NoValuePolicy::narrow_exception_check(std::move(*this)); }
- constexpr void assume_exception() const && noexcept { NoValuePolicy::narrow_exception_check(std::move(*this)); }
- constexpr void exception() & { NoValuePolicy::wide_exception_check(*this); }
- constexpr void exception() const & { NoValuePolicy::wide_exception_check(*this); }
- constexpr void exception() && { NoValuePolicy::wide_exception_check(std::move(*this)); }
- constexpr void exception() const && { NoValuePolicy::wide_exception_check(std::move(*this)); }
- };
- }
- BOOST_OUTCOME_V2_NAMESPACE_END
- #endif
|