Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:43:31

0001 //
0002 // traits/query_static_constexpr_member.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_TRAITS_QUERY_STATIC_CONSTEXPR_MEMBER_HPP
0012 #define BOOST_ASIO_TRAITS_QUERY_STATIC_CONSTEXPR_MEMBER_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/type_traits.hpp>
0020 
0021 #if defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE) \
0022   && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
0023 # define BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT 1
0024 #endif // defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
0025        //   && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
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 query_static_constexpr_member_default;
0035 
0036 template <typename T, typename Property, typename = void>
0037 struct query_static_constexpr_member;
0038 
0039 } // namespace traits
0040 namespace detail {
0041 
0042 struct no_query_static_constexpr_member
0043 {
0044   static constexpr bool is_valid = false;
0045 };
0046 
0047 template <typename T, typename Property, typename = void>
0048 struct query_static_constexpr_member_trait :
0049   conditional_t<
0050     is_same<T, decay_t<T>>::value
0051       && is_same<Property, decay_t<Property>>::value,
0052     no_query_static_constexpr_member,
0053     traits::query_static_constexpr_member<
0054       decay_t<T>,
0055       decay_t<Property>>
0056   >
0057 {
0058 };
0059 
0060 #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
0061 
0062 template <typename T, typename Property>
0063 struct query_static_constexpr_member_trait<T, Property,
0064   enable_if_t<
0065     (static_cast<void>(T::query(Property{})), true)
0066   >>
0067 {
0068   static constexpr bool is_valid = true;
0069 
0070   using result_type = decltype(T::query(Property{}));
0071 
0072   static constexpr bool is_noexcept = noexcept(T::query(Property{}));
0073 
0074   static constexpr result_type value() noexcept(is_noexcept)
0075   {
0076     return T::query(Property{});
0077   }
0078 };
0079 
0080 #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
0081 
0082 } // namespace detail
0083 namespace traits {
0084 
0085 template <typename T, typename Property, typename>
0086 struct query_static_constexpr_member_default :
0087   detail::query_static_constexpr_member_trait<T, Property>
0088 {
0089 };
0090 
0091 template <typename T, typename Property, typename>
0092 struct query_static_constexpr_member :
0093   query_static_constexpr_member_default<T, Property>
0094 {
0095 };
0096 
0097 } // namespace traits
0098 } // namespace asio
0099 } // namespace boost
0100 
0101 #include <boost/asio/detail/pop_options.hpp>
0102 
0103 #endif // BOOST_ASIO_TRAITS_QUERY_STATIC_CONSTEXPR_MEMBER_HPP