2 // Copyright Aleksey Gurtovoy 2000-2005
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.hpp>
15 #include <boost/mpl/vector/vector10.hpp>
16 #include <boost/mpl/equal.hpp>
17 #include <boost/mpl/push_back.hpp>
18 #include <boost/mpl/pop_back.hpp>
19 #include <boost/mpl/push_front.hpp>
20 #include <boost/mpl/pop_front.hpp>
21 #include <boost/mpl/back.hpp>
22 #include <boost/mpl/front.hpp>
23 #include <boost/mpl/size.hpp>
24 #include <boost/mpl/empty.hpp>
26 #include <boost/mpl/aux_/test.hpp>
32 typedef vector1
<char> v1
;
33 typedef vector2
<char,long> v2
;
34 typedef vector9
<char,char,char,char,char,char,char,char,int> v9
;
36 MPL_ASSERT(( equal
< v0
,v0::type
> ));
37 MPL_ASSERT(( equal
< v1
,v1::type
> ));
38 MPL_ASSERT(( equal
< v2
,v2::type
> ));
39 MPL_ASSERT(( equal
< v9
,v9::type
> ));
41 MPL_ASSERT_RELATION( size
<v0
>::value
, ==, 0 );
42 MPL_ASSERT_RELATION( size
<v1
>::value
, ==, 1 );
43 MPL_ASSERT_RELATION( size
<v2
>::value
, ==, 2 );
44 MPL_ASSERT_RELATION( size
<v9
>::value
, ==, 9 );
46 MPL_ASSERT(( empty
<v0
> ));
47 MPL_ASSERT_NOT(( empty
<v1
> ));
48 MPL_ASSERT_NOT(( empty
<v2
> ));
49 MPL_ASSERT_NOT(( empty
<v9
> ));
51 MPL_ASSERT(( is_same
< front
<v1
>::type
,char > ));
52 MPL_ASSERT(( is_same
< back
<v1
>::type
,char > ));
53 MPL_ASSERT(( is_same
< front
<v2
>::type
,char > ));
54 MPL_ASSERT(( is_same
< back
<v2
>::type
,long > ));
55 MPL_ASSERT(( is_same
< front
<v9
>::type
,char > ));
56 MPL_ASSERT(( is_same
< back
<v9
>::type
,int > ));
62 typedef vector2
<char,long> v2
;
64 typedef begin
<v2
>::type i1
;
65 typedef next
<i1
>::type i2
;
66 typedef next
<i2
>::type i3
;
68 MPL_ASSERT(( is_same
<deref
<i1
>::type
,char> ));
69 MPL_ASSERT(( is_same
<deref
<i2
>::type
,long> ));
70 MPL_ASSERT(( is_same
< i3
, end
<v2
>::type
> ));
77 typedef push_back
<v0
,int>::type v1
;
78 typedef push_front
<v1
,char>::type v2
;
79 typedef push_back
<v2
,long>::type v3
;
81 MPL_ASSERT(( is_same
< back
<v1
>::type
,int > ));
82 MPL_ASSERT(( is_same
< back
<v2
>::type
,int > ));
83 MPL_ASSERT(( is_same
< front
<v2
>::type
,char > ));
84 MPL_ASSERT(( is_same
< back
<v3
>::type
,long > ));
86 MPL_ASSERT(( equal
< v1
,v1::type
> ));
87 MPL_ASSERT(( equal
< v2
,v2::type
> ));
88 MPL_ASSERT(( equal
< v3
,v3::type
> ));
93 typedef vector9
<char,bool,char,char,char,char,bool,long,int> v9
;
95 typedef pop_back
<v9
>::type v8
;
96 typedef pop_front
<v8
>::type v7
;
98 MPL_ASSERT(( is_same
< back
<v9
>::type
,int > ));
99 MPL_ASSERT(( is_same
< back
<v8
>::type
,long > ));
100 MPL_ASSERT(( is_same
< back
<v7
>::type
,long > ));
101 MPL_ASSERT(( is_same
< front
<v7
>::type
,bool > ));
103 MPL_ASSERT(( equal
< v9
,v9::type
> ));
104 MPL_ASSERT(( equal
< v8
,v8::type
> ));
105 MPL_ASSERT(( equal
< v7
,v7::type
> ));
111 typedef vector
<char> v1
;
112 typedef vector
<char,long> v2
;
113 typedef vector
<char,char,char,char,char,char,char,char,int> v9
;
115 MPL_ASSERT(( equal
< v0
,v0::type
> ));
116 MPL_ASSERT(( equal
< v1
,v1::type
> ));
117 MPL_ASSERT(( equal
< v2
,v2::type
> ));
118 MPL_ASSERT(( equal
< v9
,v9::type
> ));
120 MPL_ASSERT_RELATION( size
<v0
>::value
, ==, 0 );
121 MPL_ASSERT_RELATION( size
<v1
>::value
, ==, 1 );
122 MPL_ASSERT_RELATION( size
<v2
>::value
, ==, 2 );
123 MPL_ASSERT_RELATION( size
<v9
>::value
, ==, 9 );