]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/insert_range.cpp
2 // Copyright Aleksey Gurtovoy 2001-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/insert_range.hpp>
15 #include <boost/mpl/find.hpp>
16 #include <boost/mpl/vector_c.hpp>
17 #include <boost/mpl/list.hpp>
18 #include <boost/mpl/set.hpp>
19 #include <boost/mpl/set_c.hpp>
20 #include <boost/mpl/map.hpp>
21 #include <boost/mpl/size.hpp>
22 #include <boost/mpl/range_c.hpp>
23 #include <boost/mpl/equal.hpp>
24 #include <boost/mpl/fold.hpp>
25 #include <boost/mpl/placeholders.hpp>
26 #include <boost/mpl/logical.hpp>
27 #include <boost/mpl/contains.hpp>
28 #include <boost/mpl/joint_view.hpp>
30 #include <boost/mpl/aux_/test.hpp>
34 typedef vector_c
<int,0,1,7,8,9> numbers
;
35 typedef find
< numbers
,integral_c
<int,7> >::type pos
;
36 typedef insert_range
< numbers
,pos
,range_c
<int,2,7> >::type range
;
38 MPL_ASSERT_RELATION( size
<range
>::value
, ==, 10 );
39 MPL_ASSERT(( equal
< range
,range_c
<int,0,10> > ));
41 typedef insert_range
< list0
<>,end
< list0
<> >::type
,list1
<int> >::type result2
;
42 MPL_ASSERT_RELATION( size
<result2
>::value
, ==, 1 );
45 template<typename A
, typename B
>
46 void test_associative()
48 typedef typename insert_range
< A
,typename end
< A
>::type
,B
>::type C
;
50 MPL_ASSERT_RELATION( size
<C
>::value
, <=, (size
<A
>::value
+ size
<B
>::value
) );
51 MPL_ASSERT(( fold
< joint_view
< A
,B
>,true_
,and_
< _1
,contains
< C
,_2
> > > ));
56 typedef set3
< short,int,long > signed_integers
;
57 typedef set3
< unsigned short,unsigned int,unsigned long > unsigned_integers
;
58 test_associative
<signed_integers
, unsigned_integers
>();
60 typedef set_c
< int,1,3,5,7,9 > odds
;
61 typedef set_c
< int,0,2,4,6,8 > evens
;
62 test_associative
<odds
, evens
>();
69 pair
< void const,void const* >
70 , pair
< int const,int const* >
72 test_associative
<pointers
, pointers_to_const
>();