2 // traits/require_concept_free.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP
12 #define BOOST_ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/type_traits.hpp>
21 #if defined(BOOST_ASIO_HAS_DECLTYPE) \
22 && defined(BOOST_ASIO_HAS_NOEXCEPT) \
23 && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
24 # define BOOST_ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT 1
25 #endif // defined(BOOST_ASIO_HAS_DECLTYPE)
26 // && defined(BOOST_ASIO_HAS_NOEXCEPT)
27 // && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
29 #include <boost/asio/detail/push_options.hpp>
35 template <typename T, typename Property, typename = void>
36 struct require_concept_free_default;
38 template <typename T, typename Property, typename = void>
39 struct require_concept_free;
44 struct no_require_concept_free
46 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
47 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
50 #if defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
52 template <typename T, typename Property, typename = void>
53 struct require_concept_free_trait : no_require_concept_free
57 template <typename T, typename Property>
58 struct require_concept_free_trait<T, Property,
60 decltype(require_concept(declval<T>(), declval<Property>()))
63 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
65 using result_type = decltype(
66 require_concept(declval<T>(), declval<Property>()));
68 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
69 require_concept(declval<T>(), declval<Property>())));
72 #else // defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
74 template <typename T, typename Property, typename = void>
75 struct require_concept_free_trait :
77 is_same<T, typename decay<T>::type>::value
78 && is_same<Property, typename decay<Property>::type>::value,
79 no_require_concept_free,
80 traits::require_concept_free<
81 typename decay<T>::type,
82 typename decay<Property>::type>
87 #endif // defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
92 template <typename T, typename Property, typename>
93 struct require_concept_free_default :
94 detail::require_concept_free_trait<T, Property>
98 template <typename T, typename Property, typename>
99 struct require_concept_free :
100 require_concept_free_default<T, Property>
104 } // namespace traits
108 #include <boost/asio/detail/pop_options.hpp>
110 #endif // BOOST_ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP