]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/callable_traits/test/has_member_qualifiers_simple.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / has_member_qualifiers_simple.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/has_member_qualifiers.hpp>
11 #include "test.hpp"
12
13
14
15 struct foo {};
16
17 template<typename T>
18 void assert_qualified() {
19 CT_ASSERT( has_member_qualifiers<T>::value);
20 }
21
22 template<typename T>
23 void assert_unqualified() {
24 CT_ASSERT(! has_member_qualifiers<T>::value);
25 }
26
27 int main() {
28
29 {
30 using f = void(foo::*)();
31 using c = void(foo::*)() const;
32 using v = void(foo::*)() volatile;
33 using cv = void(foo::*)() const volatile;
34
35 assert_unqualified<f>();
36 assert_qualified<c>();
37 assert_qualified<v>();
38 assert_qualified<cv>();
39 }
40
41 {
42 struct f { int operator()() { return 0; } };
43 struct c { int operator()() const { return 0; } };
44 struct v { int operator()() volatile { return 0; } };
45 struct cv { int operator()() const volatile { return 0; } };
46
47 assert_unqualified<f>();
48 assert_qualified<c>();
49 assert_qualified<v>();
50 assert_qualified<cv>();
51 }
52
53 using f_ptr = void(*)();
54 assert_unqualified<f_ptr>();
55 assert_unqualified<f_ptr foo::*>();
56 assert_unqualified<int foo::*>();
57 assert_unqualified<void(&)()>();
58 }