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 <tuple>
10 #include <boost/callable_traits/remove_member_reference.hpp>
11 #include "test.hpp"
12
13 #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
main()14 int main(){ return 0; }
15 #else
16
17
18 struct foo{};
19
main()20 int main() {
21 {
22 using f = void(foo::*)();
23 using l = void(foo::*)() &;
24 using r = void(foo::*)() &&;
25 using c = void(foo::*)() const;
26 using cl = void(foo::*)() const &;
27 using cr = void(foo::*)() const &&;
28 using v = void(foo::*)() volatile;
29 using vl = void(foo::*)() volatile &;
30 using vr = void(foo::*)() volatile &&;
31 using cv = void(foo::*)() const volatile;
32 using cvl = void(foo::*)() const volatile &;
33 using cvr = void(foo::*)() const volatile &&;
34
35 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, f)>{});
36 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, c)>{});
37 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, v)>{});
38 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cv)>{});
39 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, l)>{});
40 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, cl)>{});
41 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, vl)>{});
42 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cvl)>{});
43 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, r)>{});
44 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, cr)>{});
45 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, vr)>{});
46 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cvr)>{});
47 }
48
49 {
50 using f = void();
51 using l = void() &;
52 using r = void() &&;
53 using c = void() const;
54 using cl = void() const &;
55 using cr = void() const &&;
56 using v = void() volatile;
57 using vl = void() volatile &;
58 using vr = void() volatile &&;
59 using cv = void() const volatile;
60 using cvl = void() const volatile &;
61 using cvr = void() const volatile &&;
62
63 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, f)>{});
64 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, c)>{});
65 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, v)>{});
66 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cv)>{});
67 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, l)>{});
68 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, cl)>{});
69 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, vl)>{});
70 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cvl)>{});
71 CT_ASSERT(std::is_same<f, TRAIT(remove_member_reference, r)>{});
72 CT_ASSERT(std::is_same<c, TRAIT(remove_member_reference, cr)>{});
73 CT_ASSERT(std::is_same<v, TRAIT(remove_member_reference, vr)>{});
74 CT_ASSERT(std::is_same<cv, TRAIT(remove_member_reference, cvr)>{});
75 }
76 }
77
78 #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS
79