Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:03

0001 //
0002 // traits/static_require_concept.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 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_STATIC_REQUIRE_CONCEPT_HPP
0012 #define BOOST_ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_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 #include <boost/asio/traits/static_query.hpp>
0021 
0022 #define BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_CONCEPT_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_concept_default;
0032 
0033 template <typename T, typename Property, typename = void>
0034 struct static_require_concept;
0035 
0036 } // namespace traits
0037 namespace detail {
0038 
0039 struct no_static_require_concept
0040 {
0041   static constexpr bool is_valid = false;
0042 };
0043 
0044 template <typename T, typename Property, typename = void>
0045 struct static_require_concept_trait :
0046   conditional_t<
0047     is_same<T, decay_t<T>>::value
0048       && is_same<Property, decay_t<Property>>::value,
0049     no_static_require_concept,
0050     traits::static_require_concept<
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_concept_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 // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
0069 
0070 false_type static_require_concept_test(...);
0071 
0072 template <typename T, typename Property>
0073 true_type static_require_concept_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_concept
0080 {
0081   static constexpr bool value =
0082     decltype((static_require_concept_test)(
0083       static_cast<T*>(0), static_cast<Property*>(0)))::value;
0084 };
0085 
0086 template <typename T, typename Property>
0087 struct static_require_concept_trait<T, Property,
0088   enable_if_t<
0089     has_static_require_concept<decay_t<T>,
0090       decay_t<Property>>::value
0091   >>
0092 {
0093   static constexpr bool is_valid = true;
0094 };
0095 
0096 #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
0097 
0098 } // namespace detail
0099 namespace traits {
0100 
0101 template <typename T, typename Property, typename>
0102 struct static_require_concept_default :
0103   detail::static_require_concept_trait<T, Property>
0104 {
0105 };
0106 
0107 template <typename T, typename Property, typename>
0108 struct static_require_concept : static_require_concept_default<T, Property>
0109 {
0110 };
0111 
0112 } // namespace traits
0113 } // namespace asio
0114 } // namespace boost
0115 
0116 #include <boost/asio/detail/pop_options.hpp>
0117 
0118 #endif // BOOST_ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP