File indexing completed on 2025-01-18 09:29:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_TRAITS_STATIC_REQUIRE_HPP
0012 #define BOOST_ASIO_TRAITS_STATIC_REQUIRE_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/type_traits.hpp>
0020 #include <boost/asio/traits/static_query.hpp>
0021
0022 #define BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT 1
0023
0024 #include <boost/asio/detail/push_options.hpp>
0025
0026 namespace boost {
0027 namespace asio {
0028 namespace traits {
0029
0030 template <typename T, typename Property, typename = void>
0031 struct static_require_default;
0032
0033 template <typename T, typename Property, typename = void>
0034 struct static_require;
0035
0036 }
0037 namespace detail {
0038
0039 struct no_static_require
0040 {
0041 static constexpr bool is_valid = false;
0042 };
0043
0044 template <typename T, typename Property, typename = void>
0045 struct static_require_trait :
0046 conditional_t<
0047 is_same<T, decay_t<T>>::value
0048 && is_same<Property, decay_t<Property>>::value,
0049 no_static_require,
0050 traits::static_require<
0051 decay_t<T>,
0052 decay_t<Property>>
0053 >
0054 {
0055 };
0056
0057 #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
0058
0059 template <typename T, typename Property>
0060 struct static_require_trait<T, Property,
0061 enable_if_t<
0062 decay_t<Property>::value() == traits::static_query<T, Property>::value()
0063 >>
0064 {
0065 static constexpr bool is_valid = true;
0066 };
0067
0068 #else
0069
0070 false_type static_require_test(...);
0071
0072 template <typename T, typename Property>
0073 true_type static_require_test(T*, Property*,
0074 enable_if_t<
0075 Property::value() == traits::static_query<T, Property>::value()
0076 >* = 0);
0077
0078 template <typename T, typename Property>
0079 struct has_static_require
0080 {
0081 static constexpr bool value =
0082 decltype((static_require_test)(
0083 static_cast<T*>(0), static_cast<Property*>(0)))::value;
0084 };
0085
0086 template <typename T, typename Property>
0087 struct static_require_trait<T, Property,
0088 enable_if_t<
0089 has_static_require<decay_t<T>,
0090 decay_t<Property>>::value
0091 >>
0092 {
0093 static constexpr bool is_valid = true;
0094 };
0095
0096 #endif
0097
0098 }
0099 namespace traits {
0100
0101 template <typename T, typename Property, typename>
0102 struct static_require_default : detail::static_require_trait<T, Property>
0103 {
0104 };
0105
0106 template <typename T, typename Property, typename>
0107 struct static_require : static_require_default<T, Property>
0108 {
0109 };
0110
0111 }
0112 }
0113 }
0114
0115 #include <boost/asio/detail/pop_options.hpp>
0116
0117 #endif