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)
10 #include <boost/callable_traits/remove_varargs.hpp>
20 using f
= void(foo::*)();
21 using l
= void(foo::*)() LREF
;
22 using r
= void(foo::*)() RREF
;
23 using c
= void(foo::*)() const;
24 using cl
= void(foo::*)() const LREF
;
25 using cr
= void(foo::*)() const RREF
;
26 using v
= void(foo::*)() volatile;
27 using vl
= void(foo::*)() volatile LREF
;
28 using vr
= void(foo::*)() volatile RREF
;
29 using cv
= void(foo::*)() const volatile;
30 using cvl
= void(foo::*)() const volatile LREF
;
31 using cvr
= void(foo::*)() const volatile RREF
;
33 using va_f
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...);
34 using va_l
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) LREF
;
35 using va_r
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) RREF
;
36 using va_c
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const;
37 using va_cl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const LREF
;
38 using va_cr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const RREF
;
39 using va_v
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) volatile;
40 using va_vl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) volatile LREF
;
41 using va_vr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) volatile RREF
;
42 using va_cv
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const volatile;
43 using va_cvl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const volatile LREF
;
44 using va_cvr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(...) const volatile RREF
;
46 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, va_f
)>{});
47 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, va_l
)>{});
48 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, va_r
)>{});
49 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, va_c
)>{});
50 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, va_cl
)>{});
51 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, va_cr
)>{});
52 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, va_v
)>{});
53 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, va_vl
)>{});
54 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, va_vr
)>{});
55 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, va_cv
)>{});
56 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, va_cvl
)>{});
57 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, va_cvr
)>{});
59 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, f
)>{});
60 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, l
)>{});
61 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, r
)>{});
62 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, c
)>{});
63 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, cl
)>{});
64 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, cr
)>{});
65 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, v
)>{});
66 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, vl
)>{});
67 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, vr
)>{});
68 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, cv
)>{});
69 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, cvl
)>{});
70 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, cvr
)>{});
74 using f
= void(foo::*)(int&, int&&);
75 using l
= void(foo::*)(int&, int&&) LREF
;
76 using r
= void(foo::*)(int&, int&&) RREF
;
77 using c
= void(foo::*)(int&, int&&) const;
78 using cl
= void(foo::*)(int&, int&&) const LREF
;
79 using cr
= void(foo::*)(int&, int&&) const RREF
;
80 using v
= void(foo::*)(int&, int&&) volatile;
81 using vl
= void(foo::*)(int&, int&&) volatile LREF
;
82 using vr
= void(foo::*)(int&, int&&) volatile RREF
;
83 using cv
= void(foo::*)(int&, int&&) const volatile;
84 using cvl
= void(foo::*)(int&, int&&) const volatile LREF
;
85 using cvr
= void(foo::*)(int&, int&&) const volatile RREF
;
87 using va_f
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...);
88 using va_l
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) LREF
;
89 using va_r
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) RREF
;
90 using va_c
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const;
91 using va_cl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const LREF
;
92 using va_cr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const RREF
;
93 using va_v
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) volatile;
94 using va_vl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) volatile LREF
;
95 using va_vr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) volatile RREF
;
96 using va_cv
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const volatile;
97 using va_cvl
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const volatile LREF
;
98 using va_cvr
= void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC
foo::*)(int&, int&&, ...) const volatile RREF
;
100 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, va_f
)>{});
101 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, va_l
)>{});
102 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, va_r
)>{});
103 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, va_c
)>{});
104 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, va_cl
)>{});
105 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, va_cr
)>{});
106 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, va_v
)>{});
107 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, va_vl
)>{});
108 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, va_vr
)>{});
109 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, va_cv
)>{});
110 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, va_cvl
)>{});
111 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, va_cvr
)>{});
113 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, f
)>{});
114 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, l
)>{});
115 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, r
)>{});
116 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, c
)>{});
117 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, cl
)>{});
118 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, cr
)>{});
119 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, v
)>{});
120 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, vl
)>{});
121 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, vr
)>{});
122 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, cv
)>{});
123 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, cvl
)>{});
124 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, cvr
)>{});
127 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
131 using l
= void() LREF
;
132 using r
= void() RREF
;
133 using c
= void() const;
134 using cl
= void() const LREF
;
135 using cr
= void() const RREF
;
136 using v
= void() volatile;
137 using vl
= void() volatile LREF
;
138 using vr
= void() volatile RREF
;
139 using cv
= void() const volatile;
140 using cvl
= void() const volatile LREF
;
141 using cvr
= void() const volatile RREF
;
143 using va_f
= void(...);
144 using va_l
= void(...) LREF
;
145 using va_r
= void(...) RREF
;
146 using va_c
= void(...) const;
147 using va_cl
= void(...) const LREF
;
148 using va_cr
= void(...) const RREF
;
149 using va_v
= void(...) volatile;
150 using va_vl
= void(...) volatile LREF
;
151 using va_vr
= void(...) volatile RREF
;
152 using va_cv
= void(...) const volatile;
153 using va_cvl
= void(...) const volatile LREF
;
154 using va_cvr
= void(...) const volatile RREF
;
156 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, va_f
)>{});
157 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, va_l
)>{});
158 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, va_r
)>{});
159 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, va_c
)>{});
160 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, va_cl
)>{});
161 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, va_cr
)>{});
162 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, va_v
)>{});
163 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, va_vl
)>{});
164 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, va_vr
)>{});
165 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, va_cv
)>{});
166 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, va_cvl
)>{});
167 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, va_cvr
)>{});
169 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, f
)>{});
170 CT_ASSERT(std::is_same
<l
, TRAIT(remove_varargs
, l
)>{});
171 CT_ASSERT(std::is_same
<r
, TRAIT(remove_varargs
, r
)>{});
172 CT_ASSERT(std::is_same
<c
, TRAIT(remove_varargs
, c
)>{});
173 CT_ASSERT(std::is_same
<cl
, TRAIT(remove_varargs
, cl
)>{});
174 CT_ASSERT(std::is_same
<cr
, TRAIT(remove_varargs
, cr
)>{});
175 CT_ASSERT(std::is_same
<v
, TRAIT(remove_varargs
, v
)>{});
176 CT_ASSERT(std::is_same
<vl
, TRAIT(remove_varargs
, vl
)>{});
177 CT_ASSERT(std::is_same
<vr
, TRAIT(remove_varargs
, vr
)>{});
178 CT_ASSERT(std::is_same
<cv
, TRAIT(remove_varargs
, cv
)>{});
179 CT_ASSERT(std::is_same
<cvl
, TRAIT(remove_varargs
, cvl
)>{});
180 CT_ASSERT(std::is_same
<cvr
, TRAIT(remove_varargs
, cvr
)>{});
183 #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
187 using va_f
= void(&)(...);
188 CT_ASSERT(std::is_same
<f
, TRAIT(remove_varargs
, va_f
)>{});