Improve vacpp support.
[boost.git] / boost / libs / python / test / if_else.cpp
blob1c6258db708869af942ddd478b84bf33cefda939
1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #include <boost/static_assert.hpp>
6 #include <boost/python/detail/if_else.hpp>
7 #include <boost/type_traits/same_traits.hpp>
9 typedef char c1;
10 typedef char c2[2];
11 typedef char c3[3];
12 typedef char c4[4];
14 template <unsigned size>
15 struct choose
17 typedef typename boost::python::detail::if_<
18 (sizeof(c1) == size)
19 >::template then<
21 >::template elif<
22 (sizeof(c2) == size)
23 >::template then<
25 >::template elif<
26 (sizeof(c3) == size)
27 >::template then<
29 >::template elif<
30 (sizeof(c4) == size)
31 >::template then<
33 >::template else_<void*>::type type;
36 int main()
38 BOOST_STATIC_ASSERT((boost::is_same<choose<1>::type,c1>::value));
39 BOOST_STATIC_ASSERT((boost::is_same<choose<2>::type,c2>::value));
40 BOOST_STATIC_ASSERT((boost::is_same<choose<3>::type,c3>::value));
41 BOOST_STATIC_ASSERT((boost::is_same<choose<4>::type,c4>::value));
42 BOOST_STATIC_ASSERT((boost::is_same<choose<5>::type,void*>::value));
43 return 0;