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