• 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/remove_member_const.hpp>
11 #include "test.hpp"
12 
13 
14 
15 struct foo {};
16 
main()17 int main() {
18 
19     {
20         using f =   void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...);
21         using l =   void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) LREF;
22         using r =   void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) RREF ;
23         using c =   void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const;
24         using cl =  void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const LREF;
25         using cr =  void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const RREF;
26         using v =   void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile;
27         using vl =  void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF;
28         using vr =  void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF;
29         using cv =  void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile;
30         using cvl = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF;
31         using cvr = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF;
32 
33         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  f)>{});
34         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  c)>{});
35         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  l)>{});
36         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  cl)>{});
37         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  r)>{});
38         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  cr)>{});
39         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  v)>{});
40         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  cv)>{});
41         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  vl)>{});
42         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  cvl)>{});
43         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  vr)>{});
44         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  cvr)>{});
45     }
46 
47     {
48         using f =   foo const & (foo::*)(int, int);
49         using l =   foo const & (foo::*)(int, int) LREF;
50         using r =   foo const & (foo::*)(int, int) RREF ;
51         using c =   foo const & (foo::*)(int, int) const;
52         using cl =  foo const & (foo::*)(int, int) const LREF;
53         using cr =  foo const & (foo::*)(int, int) const RREF;
54         using v =   foo const & (foo::*)(int, int) volatile;
55         using vl =  foo const & (foo::*)(int, int) volatile LREF;
56         using vr =  foo const & (foo::*)(int, int) volatile RREF;
57         using cv =  foo const & (foo::*)(int, int) const volatile;
58         using cvl = foo const & (foo::*)(int, int) const volatile LREF;
59         using cvr = foo const & (foo::*)(int, int) const volatile RREF;
60 
61         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  f)>{});
62         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  c)>{});
63         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  l)>{});
64         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  cl)>{});
65         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  r)>{});
66         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  cr)>{});
67         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  v)>{});
68         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  cv)>{});
69         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  vl)>{});
70         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  cvl)>{});
71         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  vr)>{});
72         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  cvr)>{});
73     }
74 
75 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
76 
77     {
78         using f =   void();
79         using l =   void() LREF;
80         using r =   void() RREF ;
81         using c =   void() const;
82         using cl =  void() const LREF;
83         using cr =  void() const RREF;
84         using v =   void() volatile;
85         using vl =  void() volatile LREF;
86         using vr =  void() volatile RREF;
87         using cv =  void() const volatile;
88         using cvl = void() const volatile LREF;
89         using cvr = void() const volatile RREF;
90 
91         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  f)>{});
92         CT_ASSERT(std::is_same<f,   TRAIT(remove_member_const,  c)>{});
93         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  l)>{});
94         CT_ASSERT(std::is_same<l,   TRAIT(remove_member_const,  cl)>{});
95         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  r)>{});
96         CT_ASSERT(std::is_same<r,   TRAIT(remove_member_const,  cr)>{});
97         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  v)>{});
98         CT_ASSERT(std::is_same<v,   TRAIT(remove_member_const,  cv)>{});
99         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  vl)>{});
100         CT_ASSERT(std::is_same<vl,  TRAIT(remove_member_const,  cvl)>{});
101         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  vr)>{});
102         CT_ASSERT(std::is_same<vr,  TRAIT(remove_member_const,  cvr)>{});
103     }
104 
105 #endif
106 }
107