File indexing completed on 2024-11-15 09:20:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifndef BOOST_OUTCOME_BASIC_OUTCOME_EXCEPTION_OBSERVERS_IMPL_HPP
0032 #define BOOST_OUTCOME_BASIC_OUTCOME_EXCEPTION_OBSERVERS_IMPL_HPP
0033
0034 #include "basic_outcome_exception_observers.hpp"
0035
0036 #include "../policy/base.hpp"
0037
0038 BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
0039
0040 namespace policy
0041 {
0042 template <class R, class S, class P, class NoValuePolicy, class Impl> inline constexpr auto &&base::_exception(Impl &&self) noexcept
0043 {
0044
0045
0046 using Outcome = BOOST_OUTCOME_V2_NAMESPACE::detail::rebind_type<basic_outcome<R, S, P, NoValuePolicy>, decltype(self)>;
0047 #if defined(_MSC_VER) && _MSC_VER < 1920
0048
0049 basic_outcome<R, S, P, NoValuePolicy> &_self = (basic_outcome<R, S, P, NoValuePolicy> &) (self);
0050 #else
0051 Outcome _self = static_cast<Outcome>(self);
0052 #endif
0053 return static_cast<Outcome>(_self)._ptr;
0054 }
0055 }
0056
0057 namespace detail
0058 {
0059 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::assume_exception() & noexcept
0060 {
0061 NoValuePolicy::narrow_exception_check(*this);
0062 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(*this);
0063 }
0064 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr const typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::assume_exception() const &noexcept
0065 {
0066 NoValuePolicy::narrow_exception_check(*this);
0067 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(*this);
0068 }
0069 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &&basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::assume_exception() && noexcept
0070 {
0071 NoValuePolicy::narrow_exception_check(std::move(*this));
0072 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(std::move(*this));
0073 }
0074 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr const typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &&basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::assume_exception() const &&noexcept
0075 {
0076 NoValuePolicy::narrow_exception_check(std::move(*this));
0077 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(std::move(*this));
0078 }
0079
0080 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception() &
0081 {
0082 NoValuePolicy::wide_exception_check(*this);
0083 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(*this);
0084 }
0085 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr const typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception() const &
0086 {
0087 NoValuePolicy::wide_exception_check(*this);
0088 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(*this);
0089 }
0090 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &&basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception() &&
0091 {
0092 NoValuePolicy::wide_exception_check(std::move(*this));
0093 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(std::move(*this));
0094 }
0095 template <class Base, class R, class S, class P, class NoValuePolicy> inline constexpr const typename basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception_type &&basic_outcome_exception_observers<Base, R, S, P, NoValuePolicy>::exception() const &&
0096 {
0097 NoValuePolicy::wide_exception_check(std::move(*this));
0098 return NoValuePolicy::template _exception<R, S, P, NoValuePolicy>(std::move(*this));
0099 }
0100 }
0101
0102 BOOST_OUTCOME_V2_NAMESPACE_END
0103
0104 #endif