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/remove_if.hpp>
16 
17 #include <boost/mpl/list/list10_c.hpp>
18 #include <boost/mpl/list/list10.hpp>
19 #include <boost/mpl/front_inserter.hpp>
20 #include <boost/mpl/greater.hpp>
21 #include <boost/mpl/int.hpp>
22 #include <boost/mpl/equal.hpp>
23 #include <boost/mpl/size.hpp>
24 #include <boost/type_traits/is_float.hpp>
25 
26 #include <boost/mpl/aux_/test.hpp>
27 
MPL_TEST_CASE()28 MPL_TEST_CASE()
29 {
30     typedef list10_c<int,0,1,2,3,4,5,6,7,8,9> numbers;
31     typedef list5_c<int,4,3,2,1,0>::type answer;
32     typedef remove_if<
33           numbers
34         , greater<_,int_<4> >
35         , mpl::front_inserter< list0_c<int> >
36         >::type result;
37 
38     MPL_ASSERT_RELATION( size<result>::value, ==, 5 );
39     MPL_ASSERT(( equal<result,answer> ));
40 }
41 
MPL_TEST_CASE()42 MPL_TEST_CASE()
43 {
44     typedef list8<int,float,long,float,char,long,double,double> types;
45     typedef list4<int,long,char,long>::type answer;
46     typedef reverse_remove_if<
47           types
48         , is_float<_>
49         , mpl::front_inserter< list0<> >
50         >::type result;
51 
52     MPL_ASSERT_RELATION( size<result>::value, ==, 4 );
53     MPL_ASSERT(( equal<result,answer> ));
54 }
55