1 // Copyright Daniel Wallin 2006.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/parameter/config.hpp>
8 #if (BOOST_PARAMETER_MAX_ARITY < 4)
9 #error Define BOOST_PARAMETER_MAX_ARITY as 4 or greater.
23 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
24 #include <type_traits>
26 #include <boost/mpl/bool.hpp>
27 #include <boost/mpl/if.hpp>
28 #include <boost/type_traits/is_base_of.hpp>
29 #include <boost/type_traits/remove_const.hpp>
30 #include <boost/type_traits/remove_reference.hpp>
37 template <typename T
, typename Args
>
38 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
39 using fn
= std::is_base_of
<
41 , typename
std::remove_const
<
42 typename
std::remove_reference
<T
>::type
50 , typename
boost::remove_const
<
51 typename
boost::remove_reference
<T
>::type
59 #endif // BOOST_PARAMETER_CAN_USE_MP11
63 #include <boost/parameter/template_keyword.hpp>
67 template <typename T
= int>
68 struct a0_is
: boost::parameter::template_keyword
<test::a0_is
<>,T
>
72 template <typename T
= int>
73 struct a1_is
: boost::parameter::template_keyword
<test::a1_is
<>,T
>
77 template <typename T
= int>
78 struct a2_is
: boost::parameter::template_keyword
<test::a2_is
<>,T
>
82 template <typename T
= int>
83 struct a3_is
: boost::parameter::template_keyword
<test::a3_is
<>,T
>
88 #include <boost/parameter/parameters.hpp>
89 #include <boost/parameter/optional.hpp>
90 #include <boost/parameter/deduced.hpp>
91 #include <boost/parameter/binding.hpp>
96 typename A0
= boost::parameter::void_
97 , typename A1
= boost::parameter::void_
98 , typename A2
= boost::parameter::void_
99 , typename A3
= boost::parameter::void_
103 typedef typename
boost::parameter::parameters
<
107 , boost::parameter::optional
<
108 boost::parameter::deduced
<test::a3_is
<> >
111 >::BOOST_NESTED_TEMPLATE bind
<
116 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
117 , boost::parameter::void_
120 typedef typename
boost::parameter::binding
<
125 typedef typename
boost::parameter::binding
<
130 typedef typename
boost::parameter::binding
<
135 typedef typename
boost::parameter::binding
<
140 typedef void(*type
)(a0
, a1
, a2
, a3
);
144 #include <boost/mpl/aux_/test.hpp>
146 #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
147 #include <boost/mpl/assert.hpp>
148 #include <boost/type_traits/is_same.hpp>
153 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
156 test::with_ntp
<>::type
157 , void(*)(void*, void*, void*, void*)
159 , "type must be void(*)(void*, void*, void*, void*)"
163 test::with_ntp
<test::a2_is
<int> >::type
164 , void(*)(void*, void*, int, void*)
166 , "type must be void(*)(void*, void*, int, void*)"
170 test::with_ntp
<test::a1_is
<int> >::type
171 , void(*)(void*, int, void*, void*)
173 , "type must be void(*)(void*, int, void*, void*)"
177 test::with_ntp
<test::a2_is
<int const>,test::a1_is
<float> >::type
178 , void(*)(void*, float, int const, void*)
180 , "type must be void(*)(void*, float, int const, void*)"
184 test::with_ntp
<int const>::type
185 , void(*)(int const, void*, void*, void*)
187 , "type must be void(*)(int const, void*, void*, void*)"
191 test::with_ntp
<int,float>::type
192 , void(*)(int, float, void*, void*)
194 , "type must be void(*)(int, float, void*, void*)"
198 test::with_ntp
<int,float,char>::type
199 , void(*)(int, float, char, void*)
201 , "type must be void(*)(int, float, char, void*)"
205 test::with_ntp
<test::a0_is
<int>,test::Y
>::type
206 , void(*)(int, void*, void*, test::Y
)
208 , "type must be must be void(*)(int, void*, void*, test::Y)"
212 test::with_ntp
<int&,test::a2_is
<char>,test::Y
>::type
213 , void(*)(int&, void*, char, test::Y
)
215 , "type must be void(*)(int&, void*, char, test::Y)"
217 #else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
221 test::with_ntp
<>::type
222 , void(*)(void*, void*, void*, void*)
231 test::with_ntp
<test::a2_is
<int> >::type
232 , void(*)(void*, void*, int, void*)
241 test::with_ntp
<test::a1_is
<int> >::type
242 , void(*)(void*, int, void*, void*)
252 test::a2_is
<int const>
255 , void(*)(void*, float, int const, void*)
264 test::with_ntp
<int const>::type
265 , void(*)(int const, void*, void*, void*)
274 test::with_ntp
<int,float>::type
275 , void(*)(int, float, void*, void*)
284 test::with_ntp
<int,float,char>::type
285 , void(*)(int, float, char, void*)
294 test::with_ntp
<test::a0_is
<int>,test::Y
>::type
295 , void(*)(int, void*, void*, test::Y
)
304 test::with_ntp
<int&,test::a2_is
<char>,test::Y
>::type
305 , void(*)(int&, void*, char, test::Y
)
311 #endif // BOOST_PARAMETER_CAN_USE_MP11
313 typedef int test_array
[1];
314 typedef void(*test_function
)();
316 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
319 test::with_ntp
<test_array
,test_function
>::type
320 , void(*)(test_array
&, test_function
, void*, void*)
322 , "type must be void(*)(test_array&, test_function, void*, void*)"
328 test::with_ntp
<test_array
,test_function
>::type
329 , void(*)(test_array
&, test_function
, void*, void*)