File indexing completed on 2025-12-16 09:43:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_TRAITS_STATIC_QUERY_HPP
0012 #define BOOST_ASIO_TRAITS_STATIC_QUERY_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
0021 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) \
0022 && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
0023 # define BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT 1
0024 #endif
0025
0026
0027 #include <boost/asio/detail/push_options.hpp>
0028
0029 namespace boost {
0030 namespace asio {
0031 namespace traits {
0032
0033 template <typename T, typename Property, typename = void>
0034 struct static_query_default;
0035
0036 template <typename T, typename Property, typename = void>
0037 struct static_query;
0038
0039 }
0040 namespace detail {
0041
0042 struct no_static_query
0043 {
0044 static constexpr bool is_valid = false;
0045 static constexpr bool is_noexcept = false;
0046 };
0047
0048 template <typename T, typename Property, typename = void>
0049 struct static_query_trait :
0050 conditional_t<
0051 is_same<T, decay_t<T>>::value
0052 && is_same<Property, decay_t<Property>>::value,
0053 no_static_query,
0054 traits::static_query<
0055 decay_t<T>,
0056 decay_t<Property>>
0057 >
0058 {
0059 };
0060
0061 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
0062
0063 template <typename T, typename Property>
0064 struct static_query_trait<T, Property,
0065 void_t<
0066 decltype(decay_t<Property>::template static_query_v<T>)
0067 >>
0068 {
0069 static constexpr bool is_valid = true;
0070
0071 using result_type = decltype(
0072 decay_t<Property>::template static_query_v<T>);
0073
0074 static constexpr bool is_noexcept =
0075 noexcept(decay_t<Property>::template static_query_v<T>);
0076
0077 static constexpr result_type value() noexcept(is_noexcept)
0078 {
0079 return decay_t<Property>::template static_query_v<T>;
0080 }
0081 };
0082
0083 #endif
0084
0085 }
0086 namespace traits {
0087
0088 template <typename T, typename Property, typename>
0089 struct static_query_default : detail::static_query_trait<T, Property>
0090 {
0091 };
0092
0093 template <typename T, typename Property, typename>
0094 struct static_query : static_query_default<T, Property>
0095 {
0096 };
0097
0098 }
0099 }
0100 }
0101
0102 #include <boost/asio/detail/pop_options.hpp>
0103
0104 #endif