]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/traits/equality_comparable.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / traits / equality_comparable.hpp
CommitLineData
20effc67
TL
1//
2// traits/equality_comparable.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_EQUALITY_COMPARABLE_HPP
12#define BOOST_ASIO_TRAITS_EQUALITY_COMPARABLE_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_WORKING_EXPRESSION_SFINAE)
24# define BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT 1
25#endif // defined(BOOST_ASIO_HAS_DECLTYPE)
26 // && defined(BOOST_ASIO_HAS_NOEXCEPT)
27 // && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
28
29namespace boost {
30namespace asio {
31namespace traits {
32
33template <typename T, typename = void>
34struct equality_comparable_default;
35
36template <typename T, typename = void>
37struct equality_comparable;
38
39} // namespace traits
40namespace detail {
41
42struct no_equality_comparable
43{
44 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
45 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
46};
47
48#if defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
49
50template <typename T, typename = void>
51struct equality_comparable_trait : no_equality_comparable
52{
53};
54
55template <typename T>
56struct equality_comparable_trait<T,
57 typename void_type<
58 decltype(
59 static_cast<void>(
60 static_cast<bool>(declval<const T>() == declval<const T>())
61 ),
62 static_cast<void>(
63 static_cast<bool>(declval<const T>() != declval<const T>())
64 )
65 )
66 >::type>
67{
68 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
69
70 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
71 noexcept(declval<const T>() == declval<const T>())
72 && noexcept(declval<const T>() != declval<const T>()));
73};
74
75#else // defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
76
77template <typename T, typename = void>
78struct equality_comparable_trait :
79 conditional<
80 is_same<T, typename decay<T>::type>::value,
81 no_equality_comparable,
82 traits::equality_comparable<typename decay<T>::type>
83 >::type
84{
85};
86
87#endif // defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
88
89} // namespace detail
90namespace traits {
91
92template <typename T, typename>
93struct equality_comparable_default : detail::equality_comparable_trait<T>
94{
95};
96
97template <typename T, typename>
98struct equality_comparable : equality_comparable_default<T>
99{
100};
101
102} // namespace traits
103} // namespace asio
104} // namespace boost
105
106#endif // BOOST_ASIO_TRAITS_EQUALITY_COMPARABLE_HPP