]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/parameter/test/normalized_argument_types.cpp
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>
9 #if (BOOST_PARAMETER_MAX_ARITY < 2)
10 #error Define BOOST_PARAMETER_MAX_ARITY as 2 or greater.
12 #if !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) && \
13 (BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY < 3)
14 #error Define BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
20 struct count_instances
24 ++count_instances::count
;
27 count_instances(count_instances
const&)
29 ++count_instances::count
;
33 count_instances(T
const&)
35 ++count_instances::count
;
40 --count_instances::count
;
43 static std::size_t count
;
50 std::size_t count_instances::count
= 0;
53 #include <boost/parameter/name.hpp>
57 BOOST_PARAMETER_NAME(x
)
58 BOOST_PARAMETER_NAME(y
)
61 #include <boost/parameter/preprocessor.hpp>
63 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
64 #include <type_traits>
66 #include <boost/mpl/bool.hpp>
67 #include <boost/mpl/if.hpp>
68 #include <boost/mpl/assert.hpp>
69 #include <boost/type_traits/is_convertible.hpp>
74 BOOST_PARAMETER_FUNCTION((int), f
, tag
,
83 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
85 std::is_convertible
<x_type
,long>::value
86 , "is_convertible<x_type,long>"
89 std::is_convertible
<y_type
,long>::value
90 , "is_convertible<y_type,long>"
94 typename
boost::mpl::if_
<
95 boost::is_convertible
<x_type
,long>
101 typename
boost::mpl::if_
<
102 boost::is_convertible
<y_type
,long>
107 #endif // BOOST_PARAMETER_CAN_USE_MP11
112 #include <boost/core/lightweight_test.hpp>
116 BOOST_PARAMETER_FUNCTION((int), g
, tag
,
118 (x
, (test::count_instances
))
122 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
124 std::is_convertible
<x_type
,test::count_instances
>::value
125 , "is_convertible<x_type,test::count_instances>"
129 typename
boost::mpl::if_
<
130 boost::is_convertible
<x_type
,test::count_instances
>
137 #if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
138 BOOST_TEST_LT(0, test::count_instances::count
);
143 BOOST_PARAMETER_FUNCTION((int), h
, tag
,
145 (x
, (test::count_instances
const&))
149 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
151 std::is_convertible
<x_type
,test::count_instances
const>::value
152 , "is_convertible<x_type,test::count_instances const>"
156 typename
boost::mpl::if_
<
157 boost::is_convertible
<x_type
,test::count_instances
const>
164 #if !BOOST_WORKAROUND(BOOST_GCC, < 40000)
165 BOOST_TEST_EQ(1, test::count_instances::count
);
178 return boost::report_errors();