]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/callable_traits/test/is_const_member.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / is_const_member.cpp
1 /*
2 Copyright Barrett Adair 2016-2017
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
5 */
6
7 #include <type_traits>
8 #include <functional>
9 #include <utility>
10 #include <boost/callable_traits/is_const_member.hpp>
11 #include "test.hpp"
12
13 struct foo {};
14
15 template<typename T>
16 void assert_const_qualified() {
17 CT_ASSERT( is_const_member<T>());
18 }
19
20
21 template<typename T>
22 void assert_not_const_qualified() {
23 CT_ASSERT(! is_const_member<T>());
24 }
25
26 int main() {
27
28 {
29 using f = void(foo::*)();
30 using l = void(foo::*)() LREF;
31 using r = void(foo::*)() RREF ;
32 using c = void(foo::*)() const;
33 using cl = void(foo::*)() const LREF;
34 using cr = void(foo::*)() const RREF;
35 using v = void(foo::*)() volatile;
36 using vl = void(foo::*)() volatile LREF;
37 using vr = void(foo::*)() volatile RREF;
38 using cv = void(foo::*)() const volatile;
39 using cvl = void(foo::*)() const volatile LREF;
40 using cvr = void(foo::*)() const volatile RREF;
41
42 assert_not_const_qualified<f>();
43 assert_not_const_qualified<l>();
44 assert_not_const_qualified<r>();
45 assert_const_qualified<c>();
46 assert_const_qualified<cl>();
47 assert_const_qualified<cr>();
48 assert_not_const_qualified<v>();
49 assert_not_const_qualified<vl>();
50 assert_not_const_qualified<vr>();
51 assert_const_qualified<cv>();
52 assert_const_qualified<cvl>();
53 assert_const_qualified<cvr>();
54 }
55
56 {
57 struct f { int operator()() { return 0; } };
58 struct l { int operator()() LREF { return 0; } };
59 struct r { int operator()() RREF { return 0; } };
60 struct c { int operator()() const { return 0; } };
61 struct cl { int operator()() const LREF { return 0; } };
62 struct cr { int operator()() const RREF { return 0; } };
63 struct v { int operator()() volatile { return 0; } };
64 struct vl { int operator()() volatile LREF { return 0; } };
65 struct vr { int operator()() volatile RREF { return 0; } };
66 struct cv { int operator()() const volatile { return 0; } };
67 struct cvl { int operator()() const volatile LREF { return 0; } };
68 struct cvr { int operator()() const volatile RREF { return 0; } };
69
70 assert_not_const_qualified<f>();
71 assert_not_const_qualified<l>();
72 assert_not_const_qualified<r>();
73 assert_const_qualified<c>();
74 assert_const_qualified<cl>();
75 assert_const_qualified<cr>();
76 assert_not_const_qualified<v>();
77 assert_not_const_qualified<vl>();
78 assert_not_const_qualified<vr>();
79 assert_const_qualified<cv>();
80 assert_const_qualified<cvl>();
81 assert_const_qualified<cvr>();
82 }
83
84 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
85
86 {
87 using f = void();
88 using l = void() LREF;
89 using r = void() RREF ;
90 using c = void() const;
91 using cl = void() const LREF;
92 using cr = void() const RREF;
93 using v = void() volatile;
94 using vl = void() volatile LREF;
95 using vr = void() volatile RREF;
96 using cv = void() const volatile;
97 using cvl = void() const volatile LREF;
98 using cvr = void() const volatile RREF;
99
100 CT_ASSERT(! is_const_member<f>());
101 CT_ASSERT(! is_const_member<l>());
102 CT_ASSERT(! is_const_member<r>());
103 CT_ASSERT( is_const_member<c>());
104 CT_ASSERT( is_const_member<cl>());
105 CT_ASSERT( is_const_member<cr>());
106 CT_ASSERT(! is_const_member<v>());
107 CT_ASSERT(! is_const_member<vl>());
108 CT_ASSERT(! is_const_member<vr>());
109 CT_ASSERT( is_const_member<cv>());
110 CT_ASSERT( is_const_member<cvl>());
111 CT_ASSERT( is_const_member<cvr>());
112 }
113
114 #endif
115
116 using f_ptr = void(*)();
117 assert_not_const_qualified<f_ptr>();
118 assert_not_const_qualified<f_ptr foo::*>();
119 assert_not_const_qualified<int foo::*>();
120 assert_not_const_qualified<void(&)()>();
121 }