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