123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef BOOST_OUTCOME_POLICY_FAIL_TO_COMPILE_OBSERVERS_HPP
- #define BOOST_OUTCOME_POLICY_FAIL_TO_COMPILE_OBSERVERS_HPP
- #include "base.hpp"
- BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
- #define BOOST_OUTCOME_FAIL_TO_COMPILE_OBSERVERS_MESSAGE \
- "Attempt to wide observe value, error or " \
- "exception for a basic_result/basic_outcome given an EC or EP type which is not void, and for whom " \
- "trait::is_error_code_available<EC>, trait::is_exception_ptr_available<EC>, and trait::is_exception_ptr_available<EP> " \
- "are all false. Please specify a NoValuePolicy to tell basic_result/basic_outcome what to do, or else use " \
- "a more specific convenience type alias such as unchecked<T, E> to indicate you want the wide " \
- "observers to be narrow, or checked<T, E> to indicate you always want an exception throw etc."
- namespace policy
- {
- struct fail_to_compile_observers : base
- {
- template <class Impl> static constexpr void wide_value_check(Impl && ) { static_assert(!std::is_same<Impl, Impl>::value, BOOST_OUTCOME_FAIL_TO_COMPILE_OBSERVERS_MESSAGE); }
- template <class Impl> static constexpr void wide_error_check(Impl && ) { static_assert(!std::is_same<Impl, Impl>::value, BOOST_OUTCOME_FAIL_TO_COMPILE_OBSERVERS_MESSAGE); }
- template <class Impl> static constexpr void wide_exception_check(Impl && ) { static_assert(!std::is_same<Impl, Impl>::value, BOOST_OUTCOME_FAIL_TO_COMPILE_OBSERVERS_MESSAGE); }
- };
- } // namespace policy
- #undef BOOST_OUTCOME_FAIL_TO_COMPILE_OBSERVERS_MESSAGE
- BOOST_OUTCOME_V2_NAMESPACE_END
- #endif
|