1 
2 // Copyright Aleksey Gurtovoy 2000-2004
3 // Copyright David Abrahams 2003-2004
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/mpl for documentation.
10 
11 // $Id$
12 // $Date$
13 // $Revision$
14 
15 #include <boost/mpl/copy_if.hpp>
16 #include <boost/mpl/list/list10_c.hpp>
17 #include <boost/mpl/list/list10.hpp>
18 #include <boost/mpl/front_inserter.hpp>
19 #include <boost/mpl/less.hpp>
20 #include <boost/mpl/int.hpp>
21 #include <boost/mpl/equal.hpp>
22 #include <boost/mpl/size.hpp>
23 #include <boost/type_traits/is_float.hpp>
24 
25 #include <boost/mpl/aux_/test.hpp>
26 
MPL_TEST_CASE()27 MPL_TEST_CASE()
28 {
29     typedef list10_c<int,0,1,2,3,4,5,6,7,8,9>::type numbers;
30     typedef list5_c<int,4,3,2,1,0>::type answer;
31     typedef copy_if<
32           numbers
33         , less<_,int_<5> >
34         , mpl::front_inserter< list0_c<int> >
35         >::type result;
36 
37     MPL_ASSERT_RELATION(size<result>::value, ==, 5);
38     MPL_ASSERT(( equal<result,answer> ));
39 }
40 
41 
MPL_TEST_CASE()42 MPL_TEST_CASE()
43 {
44     typedef list8<int,float,long,float,char,long,double,double>::type types;
45     typedef list4<float,float,double,double>::type float_types;
46     typedef reverse_copy_if<
47           types
48         , is_float<_>
49         , mpl::front_inserter< list0<> >
50         >::type result;
51 
52     MPL_ASSERT_RELATION(mpl::size<result>::value, ==, 4);
53     MPL_ASSERT(( equal<result,float_types> ));
54 }
55