Last change
on this file since 45 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.2 KB
|
Line | |
---|
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> |
---|
8 | |
---|
9 | typedef char c1; |
---|
10 | typedef char c2[2]; |
---|
11 | typedef char c3[3]; |
---|
12 | typedef char c4[4]; |
---|
13 | |
---|
14 | template <unsigned size> |
---|
15 | struct choose |
---|
16 | { |
---|
17 | typedef typename boost::python::detail::if_< |
---|
18 | (sizeof(c1) == size) |
---|
19 | >::template then< |
---|
20 | c1 |
---|
21 | >::template elif< |
---|
22 | (sizeof(c2) == size) |
---|
23 | >::template then< |
---|
24 | c2 |
---|
25 | >::template elif< |
---|
26 | (sizeof(c3) == size) |
---|
27 | >::template then< |
---|
28 | c3 |
---|
29 | >::template elif< |
---|
30 | (sizeof(c4) == size) |
---|
31 | >::template then< |
---|
32 | c4 |
---|
33 | >::template else_<void*>::type type; |
---|
34 | }; |
---|
35 | |
---|
36 | int main() |
---|
37 | { |
---|
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; |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.