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 < 2)
9 #error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
11 #if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
12 (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 3)
13 #error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
19 struct count_instances
23 ++count_instances::count;
26 count_instances(count_instances const&)
28 ++count_instances::count;
32 count_instances(T const&)
34 ++count_instances::count;
39 --count_instances::count;
42 static std::size_t count;
49 std::size_t count_instances::count = 0;
52 #include <boost/parameter/name.hpp>
56 BOOST_PARAMETER_NAME(x)
57 BOOST_PARAMETER_NAME(y)
60 #include <boost/parameter/preprocessor.hpp>
62 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
63 #include <type_traits>
65 #include <boost/mpl/bool.hpp>
66 #include <boost/mpl/if.hpp>
67 #include <boost/mpl/assert.hpp>
68 #include <boost/type_traits/is_convertible.hpp>
73 BOOST_PARAMETER_FUNCTION((int), f, tag,
82 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
84 std::is_convertible<x_type,long>::value
85 , "is_convertible<x_type,long>"
88 std::is_convertible<y_type,long>::value
89 , "is_convertible<y_type,long>"
93 typename boost::mpl::if_<
94 boost::is_convertible<x_type,long>
100 typename boost::mpl::if_<
101 boost::is_convertible<y_type,long>
106 #endif // BOOST_PARAMETER_CAN_USE_MP11
111 #include <boost/core/lightweight_test.hpp>
115 BOOST_PARAMETER_FUNCTION((int), g, tag,
117 (x, (test::count_instances))
121 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
123 std::is_convertible<x_type,test::count_instances>::value
124 , "is_convertible<x_type,test::count_instances>"
128 typename boost::mpl::if_<
129 boost::is_convertible<x_type,test::count_instances>
136 #if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
137 BOOST_TEST_LT(0, test::count_instances::count);
142 BOOST_PARAMETER_FUNCTION((int), h, tag,
144 (x, (test::count_instances const&))
148 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
150 std::is_convertible<x_type,test::count_instances const>::value
151 , "is_convertible<x_type,test::count_instances const>"
155 typename boost::mpl::if_<
156 boost::is_convertible<x_type,test::count_instances const>
163 #if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
164 BOOST_TEST_EQ(1, test::count_instances::count);
177 return boost::report_errors();