]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/callable_traits/test/qualifier_metafunction_constraints.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / qualifier_metafunction_constraints.hpp
1 /*
2 Copyright Barrett Adair 2016-2017
3
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
6
7 HEADER GUARDS INTENTIONALLY OMITTED
8 */
9
10 #ifndef PP_CAT
11 #define PP_CAT_(x, y) x ## y
12 #define PP_CAT(x, y) PP_CAT_(x, y)
13 #endif
14
15 template<typename T>
16 struct PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST) {
17
18 template<typename>
19 static auto test(...) -> std::true_type;
20
21 template<typename A,
22 typename std::remove_reference<
23 TRAIT(CALLABLE_TRAIT_UNDER_TEST, A)>::type* = nullptr>
24 static auto test(int) -> std::false_type;
25
26 static constexpr bool value = decltype(test<T>(0))::value;
27 };
28
29 bool PP_CAT(test_, CALLABLE_TRAIT_UNDER_TEST)() {
30 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int>::value);
31 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int &>::value);
32 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int(&)()>::value);
33 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int(*)()>::value);
34 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int(* const foo::*)()>::value);
35 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int foo::*>::value);
36 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int (foo::* &)()>::value);
37 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int (foo::* const)()>::value);
38 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int (foo::* const &)()>::value);
39 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<int (foo::* volatile)()>::value);
40
41 auto lambda = [](){};
42 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<decltype(lambda)>::value);
43 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<decltype(lambda)&>::value);
44 CT_ASSERT(PP_CAT(is_sub_failure_, CALLABLE_TRAIT_UNDER_TEST)<void>::value);
45 return true;
46 }
47
48 auto PP_CAT(var_, CALLABLE_TRAIT_UNDER_TEST) = PP_CAT(test_, CALLABLE_TRAIT_UNDER_TEST)();