]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/traits/query_static_constexpr_member.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / traits / query_static_constexpr_member.hpp
CommitLineData
20effc67
TL
1//
2// traits/query_static_constexpr_member.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
20effc67
TL
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_STATIC_CONSTEXPR_MEMBER_HPP
12#define BOOST_ASIO_TRAITS_QUERY_STATIC_CONSTEXPR_MEMBER_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_DECLTYPE) \
22 && defined(BOOST_ASIO_HAS_NOEXCEPT) \
23 && defined(BOOST_ASIO_HAS_CONSTEXPR) \
24 && defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE) \
25 && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
26# define BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT 1
27#endif // defined(BOOST_ASIO_HAS_DECLTYPE)
28 // && defined(BOOST_ASIO_HAS_NOEXCEPT)
29 // && defined(BOOST_ASIO_HAS_CONSTEXPR)
30 // && defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
31 // && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
32
33#include <boost/asio/detail/push_options.hpp>
34
35namespace boost {
36namespace asio {
37namespace traits {
38
39template <typename T, typename Property, typename = void>
40struct query_static_constexpr_member_default;
41
42template <typename T, typename Property, typename = void>
43struct query_static_constexpr_member;
44
45} // namespace traits
46namespace detail {
47
48struct no_query_static_constexpr_member
49{
50 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
51};
52
53template <typename T, typename Property, typename = void>
54struct query_static_constexpr_member_trait :
55 conditional<
56 is_same<T, typename decay<T>::type>::value
57 && is_same<Property, typename decay<Property>::type>::value,
58 no_query_static_constexpr_member,
59 traits::query_static_constexpr_member<
60 typename decay<T>::type,
61 typename decay<Property>::type>
62 >::type
63{
64};
65
66#if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
67
68template <typename T, typename Property>
69struct query_static_constexpr_member_trait<T, Property,
70 typename enable_if<
71 (static_cast<void>(T::query(Property{})), true)
72 >::type>
73{
74 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
75
76 using result_type = decltype(T::query(Property{}));
77
78 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
79 noexcept(T::query(Property{})));
80
81 static BOOST_ASIO_CONSTEXPR result_type value() noexcept(is_noexcept)
82 {
83 return T::query(Property{});
84 }
85};
86
87#endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
88
89} // namespace detail
90namespace traits {
91
92template <typename T, typename Property, typename>
93struct query_static_constexpr_member_default :
94 detail::query_static_constexpr_member_trait<T, Property>
95{
96};
97
98template <typename T, typename Property, typename>
99struct query_static_constexpr_member :
100 query_static_constexpr_member_default<T, Property>
101{
102};
103
104} // namespace traits
105} // namespace asio
106} // namespace boost
107
108#include <boost/asio/detail/pop_options.hpp>
109
110#endif // BOOST_ASIO_TRAITS_QUERY_STATIC_CONSTEXPR_MEMBER_HPP