]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright 2005 Alexander Nasonov. |
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 | ||
6 | #include <boost/mpl/at.hpp> | |
7 | #include <boost/mpl/lambda.hpp> | |
8 | #include <boost/mpl/placeholders.hpp> | |
9 | #include <boost/mpl/transform.hpp> | |
10 | #include <boost/mpl/vector.hpp> | |
11 | #include <boost/static_assert.hpp> | |
12 | #include <boost/type_traits/is_same.hpp> | |
13 | #include <boost/type_traits/promote.hpp> | |
14 | ||
15 | namespace mpl = boost::mpl; | |
16 | ||
17 | int main() | |
18 | { | |
19 | using namespace mpl::placeholders; | |
20 | ||
21 | typedef mpl::vector< char | |
22 | , signed char // 1 | |
23 | , unsigned char | |
24 | , short int const // 3 | |
25 | , unsigned short int | |
26 | , int volatile // 5 | |
27 | , unsigned int // 6 | |
28 | , long // 7 | |
29 | , unsigned long // 8 | |
30 | , float const // 9 | |
31 | > types; | |
32 | ||
33 | typedef mpl::transform< types | |
34 | , mpl::lambda< boost::promote<_> >::type | |
35 | >::type promoted; | |
36 | ||
37 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,1>::type, int >::value )); | |
38 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,3>::type, int const >::value )); | |
39 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,5>::type, int volatile >::value )); | |
40 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,6>::type, unsigned int >::value )); | |
41 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,7>::type, long >::value )); | |
42 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,8>::type, unsigned long >::value )); | |
43 | BOOST_STATIC_ASSERT(( ::boost::is_same< mpl::at_c<promoted,9>::type, double const >::value )); | |
44 | ||
45 | return 0; | |
46 | } | |
47 |