1//
2// traits/query_free.hpp
3// ~~~~~~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6//
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)
9//
10
11#ifndef BOOST_ASIO_TRAITS_QUERY_FREE_HPP
12#define BOOST_ASIO_TRAITS_QUERY_FREE_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19#include <boost/asio/detail/type_traits.hpp>
20
21#if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
22# define BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT 1
23#endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
24
25#include <boost/asio/detail/push_options.hpp>
26
27namespace boost {
28namespace asio {
29namespace traits {
30
31template <typename T, typename Property, typename = void>
32struct query_free_default;
33
34template <typename T, typename Property, typename = void>
35struct query_free;
36
37} // namespace traits
38namespace detail {
39
40struct no_query_free
41{
42 static constexpr bool is_valid = false;
43 static constexpr bool is_noexcept = false;
44};
45
46#if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
47
48template <typename T, typename Property, typename = void>
49struct query_free_trait : no_query_free
50{
51};
52
53template <typename T, typename Property>
54struct query_free_trait<T, Property,
55 void_t<
56 decltype(query(declval<T>(), declval<Property>()))
57 >>
58{
59 static constexpr bool is_valid = true;
60
61 using result_type = decltype(
62 query(declval<T>(), declval<Property>()));
63
64 static constexpr bool is_noexcept =
65 noexcept(query(declval<T>(), declval<Property>()));
66};
67
68#else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
69
70template <typename T, typename Property, typename = void>
71struct query_free_trait :
72 conditional_t<
73 is_same<T, decay_t<T>>::value
74 && is_same<Property, decay_t<Property>>::value,
75 no_query_free,
76 traits::query_free<
77 decay_t<T>,
78 decay_t<Property>>
79 >
80{
81};
82
83#endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
84
85} // namespace detail
86namespace traits {
87
88template <typename T, typename Property, typename>
89struct query_free_default :
90 detail::query_free_trait<T, Property>
91{
92};
93
94template <typename T, typename Property, typename>
95struct query_free :
96 query_free_default<T, Property>
97{
98};
99
100} // namespace traits
101} // namespace asio
102} // namespace boost
103
104#include <boost/asio/detail/pop_options.hpp>
105
106#endif // BOOST_ASIO_TRAITS_QUERY_FREE_HPP
107

source code of boost/libs/asio/include/boost/asio/traits/query_free.hpp