]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/vector_c.cpp
2 // Copyright Aleksey Gurtovoy 2000-2004
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/mpl for documentation.
14 #include <boost/mpl/vector_c.hpp>
15 #include <boost/mpl/front.hpp>
16 #include <boost/mpl/size.hpp>
18 #include <boost/mpl/aux_/test.hpp>
20 #if !BOOST_WORKAROUND(BOOST_MSVC, <=1200)
23 typedef vector_c
<bool,true>::type v1
;
24 typedef vector_c
<bool,false>::type v2
;
26 MPL_ASSERT(( is_same
< v1::value_type
, bool > ));
27 MPL_ASSERT(( is_same
< v2::value_type
, bool > ));
29 MPL_ASSERT_RELATION( front
<v1
>::type::value
, ==, true );
30 MPL_ASSERT_RELATION( front
<v2
>::type::value
, ==, false );
36 typedef vector_c
<int,-1> v1
;
37 typedef vector_c
<int,0,1> v2
;
38 typedef vector_c
<int,1,2,3> v3
;
40 MPL_ASSERT(( is_same
< v1::value_type
, int > ));
41 MPL_ASSERT(( is_same
< v2::value_type
, int > ));
42 MPL_ASSERT(( is_same
< v3::value_type
, int > ));
44 MPL_ASSERT_RELATION( size
<v1
>::value
, ==, 1 );
45 MPL_ASSERT_RELATION( size
<v2
>::value
, ==, 2 );
46 MPL_ASSERT_RELATION( size
<v3
>::value
, ==, 3 );
48 MPL_ASSERT_RELATION( front
<v1
>::type::value
, ==, -1 );
49 MPL_ASSERT_RELATION( front
<v2
>::type::value
, ==, 0 );
50 MPL_ASSERT_RELATION( front
<v3
>::type::value
, ==, 1 );
55 typedef vector_c
<unsigned,0> v1
;
56 typedef vector_c
<unsigned,1,2> v2
;
58 MPL_ASSERT(( is_same
< v1::value_type
, unsigned > ));
59 MPL_ASSERT(( is_same
< v2::value_type
, unsigned > ));
61 MPL_ASSERT_RELATION( size
<v1
>::type::value
, ==, 1 );
62 MPL_ASSERT_RELATION( size
<v2
>::type::value
, ==, 2 );
64 MPL_ASSERT_RELATION( front
<v1
>::type::value
, ==, 0 );
65 MPL_ASSERT_RELATION( front
<v2
>::type::value
, ==, 1 );