1
2 // Copyright Aleksey Gurtovoy 2004
3 //
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)
7 //
8 // See http://www.boost.org/libs/mpl for documentation.
9
10 // $Id$
11 // $Date$
12 // $Revision$
13
14 #include <boost/mpl/partition.hpp>
15 #include <boost/mpl/vector.hpp>
16 #include <boost/mpl/vector_c.hpp>
17 #include <boost/mpl/range_c.hpp>
18 #include <boost/mpl/back_inserter.hpp>
19 #include <boost/mpl/equal.hpp>
20 #include <boost/mpl/modulus.hpp>
21 #include <boost/mpl/int.hpp>
22 #include <boost/mpl/aux_/test.hpp>
23
24 template< typename N > struct is_odd
25 : modulus< N, int_<2> >
26 {
27 BOOST_MPL_AUX_LAMBDA_SUPPORT(1, is_odd, (N))
28 };
29
30
MPL_TEST_CASE()31 MPL_TEST_CASE()
32 {
33 typedef partition<
34 range_c<int,0,10>
35 , is_odd<_1>
36 , mpl::back_inserter< vector<> >
37 , mpl::back_inserter< vector<> >
38 >::type r;
39
40 MPL_ASSERT(( equal< r::first, vector_c<int,1,3,5,7,9> > ));
41 MPL_ASSERT(( equal< r::second, vector_c<int,0,2,4,6,8> > ));
42 }
43