]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/callable_traits/test/remove_transaction_safe_constraints.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / remove_transaction_safe_constraints.cpp
CommitLineData
b32b8144
FG
1/*\r
2Copyright Barrett Adair 2016-2017\r
3\r
4Distributed under the Boost Software License, Version 1.0.\r
5(See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)\r
6\r
7*/\r
8\r
9#include <boost/callable_traits/remove_transaction_safe.hpp>\r
10#include <tuple>\r
11#include "test.hpp"\r
12\r
13#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE\r
14int main(){}\r
15#else\r
16\r
17template<typename T>\r
18struct is_substitution_failure_remove_tx_safe {\r
19\r
20 template<typename>\r
21 static auto test(...) -> std::true_type;\r
22\r
23 template<typename A,\r
24 typename std::remove_reference<\r
25 TRAIT(remove_transaction_safe, A)>::type* = nullptr>\r
26 static auto test(int) -> std::false_type;\r
27\r
28 static constexpr bool value = decltype(test<T>(0))::value;\r
29};\r
30\r
31struct foo;\r
32\r
33int main() {\r
34\r
35 auto lambda = [](){};\r
36\r
37 CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)>::value);\r
38 CT_ASSERT(is_substitution_failure_remove_tx_safe<decltype(lambda)&>::value);\r
39 CT_ASSERT(is_substitution_failure_remove_tx_safe<int>::value);\r
40 CT_ASSERT(is_substitution_failure_remove_tx_safe<int &>::value);\r
41 CT_ASSERT(is_substitution_failure_remove_tx_safe<int (* const &)()>::value);\r
42 CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* &)()>::value);\r
43 CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const)()>::value);\r
44 CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* const &)()>::value);\r
45 CT_ASSERT(is_substitution_failure_remove_tx_safe<int (foo::* volatile)()>::value);\r
46 CT_ASSERT(is_substitution_failure_remove_tx_safe<void>::value);\r
47 CT_ASSERT(is_substitution_failure_remove_tx_safe<void*>::value);\r
48 CT_ASSERT(is_substitution_failure_remove_tx_safe<void(**)()>::value);\r
49}\r
50\r
51#endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE\r