File indexing completed on 2025-12-15 09:59:19
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_TRAIT_HPP
0032 #define BOOST_OUTCOME_TRAIT_HPP
0033
0034 #include "config.hpp"
0035
0036 BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
0037
0038 namespace trait
0039 {
0040
0041
0042
0043 template <class R>
0044 static constexpr bool type_can_be_used_in_basic_result =
0045 (!std::is_reference<R>::value
0046 && !BOOST_OUTCOME_V2_NAMESPACE::detail::is_in_place_type_t<std::decay_t<R>>::value
0047 && !is_success_type<R>
0048 && !is_failure_type<R>
0049 && !std::is_array<R>::value
0050 && (std::is_void<R>::value || (std::is_object<R>::value
0051 && std::is_destructible<R>::value))
0052 );
0053
0054
0055
0056
0057 template <class T> struct is_move_bitcopying
0058 {
0059 static constexpr bool value = false;
0060 };
0061
0062
0063
0064
0065 template <class E> struct is_error_type
0066 {
0067 static constexpr bool value = false;
0068 };
0069
0070
0071
0072
0073 template <class E, class Enum> struct is_error_type_enum
0074 {
0075 static constexpr bool value = false;
0076 };
0077
0078 namespace detail
0079 {
0080 template <class T> using devoid = BOOST_OUTCOME_V2_NAMESPACE::detail::devoid<T>;
0081 template <class T> std::add_rvalue_reference_t<devoid<T>> declval() noexcept;
0082
0083
0084 namespace detector_impl
0085 {
0086 template <class...> using void_t = void;
0087 template <class Default, class, template <class...> class Op, class... Args> struct detector
0088 {
0089 static constexpr bool value = false;
0090 using type = Default;
0091 };
0092 template <class Default, template <class...> class Op, class... Args> struct detector<Default, void_t<Op<Args...>>, Op, Args...>
0093 {
0094 static constexpr bool value = true;
0095 using type = Op<Args...>;
0096 };
0097 }
0098 template <template <class...> class Op, class... Args> using is_detected = detector_impl::detector<void, void, Op, Args...>;
0099
0100 template <class Arg> using result_of_make_error_code = decltype(make_error_code(declval<Arg>()));
0101 template <class Arg> using introspect_make_error_code = is_detected<result_of_make_error_code, Arg>;
0102
0103 template <class Arg> using result_of_make_exception_ptr = decltype(make_exception_ptr(declval<Arg>()));
0104 template <class Arg> using introspect_make_exception_ptr = is_detected<result_of_make_exception_ptr, Arg>;
0105
0106 template <class T> struct _is_error_code_available
0107 {
0108 static constexpr bool value = detail::introspect_make_error_code<T>::value;
0109 using type = typename detail::introspect_make_error_code<T>::type;
0110 };
0111 template <class T> struct _is_exception_ptr_available
0112 {
0113 static constexpr bool value = detail::introspect_make_exception_ptr<T>::value;
0114 using type = typename detail::introspect_make_exception_ptr<T>::type;
0115 };
0116 }
0117
0118
0119
0120
0121 template <class T> struct is_error_code_available
0122 {
0123 static constexpr bool value = detail::_is_error_code_available<std::decay_t<T>>::value;
0124 using type = typename detail::_is_error_code_available<std::decay_t<T>>::type;
0125 };
0126 template <class T> constexpr bool is_error_code_available_v = detail::_is_error_code_available<std::decay_t<T>>::value;
0127
0128
0129
0130
0131 template <class T> struct is_exception_ptr_available
0132 {
0133 static constexpr bool value = detail::_is_exception_ptr_available<std::decay_t<T>>::value;
0134 using type = typename detail::_is_exception_ptr_available<std::decay_t<T>>::type;
0135 };
0136 template <class T> constexpr bool is_exception_ptr_available_v = detail::_is_exception_ptr_available<std::decay_t<T>>::value;
0137
0138
0139 }
0140
0141 BOOST_OUTCOME_V2_NAMESPACE_END
0142
0143 #endif