]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/traits/submit_free.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / traits / submit_free.hpp
CommitLineData
20effc67
TL
1//
2// traits/submit_free.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_SUBMIT_FREE_HPP
12#define BOOST_ASIO_TRAITS_SUBMIT_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_DECLTYPE) \
22 && defined(BOOST_ASIO_HAS_NOEXCEPT) \
23 && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
24# define BOOST_ASIO_HAS_DEDUCED_SUBMIT_FREE_TRAIT 1
25#endif // defined(BOOST_ASIO_HAS_DECLTYPE)
26 // && defined(BOOST_ASIO_HAS_NOEXCEPT)
27 // && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
28
29#include <boost/asio/detail/push_options.hpp>
30
31namespace boost {
32namespace asio {
33namespace traits {
34
35template <typename S, typename R, typename = void>
36struct submit_free_default;
37
38template <typename S, typename R, typename = void>
39struct submit_free;
40
41} // namespace traits
42namespace detail {
43
44struct no_submit_free
45{
46 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
47 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
48};
49
50#if defined(BOOST_ASIO_HAS_DEDUCED_SUBMIT_FREE_TRAIT)
51
52template <typename S, typename R, typename = void>
53struct submit_free_trait : no_submit_free
54{
55};
56
57template <typename S, typename R>
58struct submit_free_trait<S, R,
59 typename void_type<
60 decltype(submit(declval<S>(), declval<R>()))
61 >::type>
62{
63 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
64
65 using result_type = decltype(
66 submit(declval<S>(), declval<R>()));
67
68 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
69 submit(declval<S>(), declval<R>())));
70};
71
72#else // defined(BOOST_ASIO_HAS_DEDUCED_SUBMIT_FREE_TRAIT)
73
74template <typename S, typename R, typename = void>
75struct submit_free_trait :
76 conditional<
77 is_same<S, typename remove_reference<S>::type>::value
78 && is_same<R, typename decay<R>::type>::value,
79 typename conditional<
80 is_same<S, typename add_const<S>::type>::value,
81 no_submit_free,
82 traits::submit_free<typename add_const<S>::type, R>
83 >::type,
84 traits::submit_free<
85 typename remove_reference<S>::type,
86 typename decay<R>::type>
87 >::type
88{
89};
90
91#endif // defined(BOOST_ASIO_HAS_DEDUCED_SUBMIT_FREE_TRAIT)
92
93} // namespace detail
94namespace traits {
95
96template <typename S, typename R, typename>
97struct submit_free_default :
98 detail::submit_free_trait<S, R>
99{
100};
101
102template <typename S, typename R, typename>
103struct submit_free :
104 submit_free_default<S, R>
105{
106};
107
108} // namespace traits
109} // namespace asio
110} // namespace boost
111
112#include <boost/asio/detail/pop_options.hpp>
113
114#endif // BOOST_ASIO_TRAITS_SUBMIT_FREE_HPP