]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/callable_traits/add_transaction_safe.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / callable_traits / add_transaction_safe.hpp
1 /*
2 @file add_transaction_safe
3
4 @Copyright Barrett Adair 2015-2017
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
7
8 */
9
10 #ifndef BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP
11 #define BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP
12
13 #include <boost/callable_traits/detail/core.hpp>
14
15 namespace boost { namespace callable_traits {
16
17 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(add_transaction_safe)
18 BOOST_CLBL_TRTS_SFINAE_MSG(add_transaction_safe, cannot_add_transaction_safe_to_this_type)
19
20 #ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
21 template<typename T>
22 struct add_transaction_safe_t {
23 static_assert(std::is_same<T, detail::dummy>::value,
24 "transaction_safe not supported by this configuration.");
25 };
26
27 template<typename T>
28 struct add_transaction_safe {
29 static_assert(std::is_same<T, detail::dummy>::value,
30 "transaction_safe not supported by this configuration.");
31 };
32
33 #else
34
35 //[ add_transaction_safe_hpp
36 /*`
37 [section:ref_add_transaction_safe add_transaction_safe]
38 [heading Header]
39 ``#include <boost/callable_traits/add_transaction_safe.hpp>``
40 [heading Definition]
41 */
42
43
44 template<typename T>
45 using add_transaction_safe_t = //see below
46 //<-
47 detail::try_but_fail_if_invalid<
48 typename detail::traits<T>::add_transaction_safe,
49 cannot_add_transaction_safe_to_this_type>;
50
51 namespace detail {
52
53 template<typename T, typename = std::false_type>
54 struct add_transaction_safe_impl {};
55
56 template<typename T>
57 struct add_transaction_safe_impl <T, typename std::is_same<
58 add_transaction_safe_t<T>, detail::dummy>::type>
59 {
60 using type = add_transaction_safe_t<T>;
61 };
62 }
63 //->
64
65 template<typename T>
66 struct add_transaction_safe
67 : detail::add_transaction_safe_impl<T> {};
68
69 //<-
70 #endif // #ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
71 }} // namespace boost::callable_traits
72 //->
73
74 /*`
75 [heading Constraints]
76 * `T` must be one of the following:
77 * function type
78 * function pointer type
79 * function reference type
80 * member function pointer type
81 * If `T` is a pointer, it may not be cv/ref qualified
82
83 [heading Behavior]
84 * A substitution failure occurs if the constraints are violated.
85 * Adds the `transaction_safe` specifier to `T`, if not already present.
86
87 [heading Input/Output Examples]
88 [table
89 [[`T`] [`add_transaction_safe_t<T>`]]
90 [[`int()`] [`int() transaction_safe`]]
91 [[`int (&)()`] [`int(&)() transaction_safe`]]
92 [[`int (*)()`] [`int(*)() transaction_safe`]]
93 [[`int(foo::*)()`] [`int(foo::*)() transaction_safe`]]
94 [[`int(foo::*)() &`] [`int(foo::*)() & transaction_safe`]]
95 [[`int(foo::*)() &&`] [`int(foo::*)() && transaction_safe`]]
96 [[`int(foo::*)() const`] [`int(foo::*)() const transaction_safe`]]
97 [[`int(foo::*)() transaction_safe`] [`int(foo::*)() transaction_safe`]]
98 [[`int`] [(substitution failure)]]
99 [[`int foo::*`] [(substitution failure)]]
100 [[`int (*&)()`] [(substitution failure)]]
101 ]
102
103 [heading Example Program]
104 [import ../example/add_transaction_safe.cpp]
105 [add_transaction_safe]
106 [endsect]
107 */
108 //]
109
110 #endif // #ifndef BOOST_CLBL_TRTS_ADD_TRANSACTION_SAFE_HPP