Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/test/partition.cpp @ 28

Last change on this file since 28 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.1 KB
Line 
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// $Source: /cvsroot/boost/boost/libs/mpl/test/partition.cpp,v $
11// $Date: 2004/11/28 03:35:12 $
12// $Revision: 1.2 $
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
24template< typename N > struct is_odd
25    : modulus< N, int_<2> > 
26{
27    BOOST_MPL_AUX_LAMBDA_SUPPORT(1, is_odd, (N))
28};
29
30
31MPL_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}
Note: See TracBrowser for help on using the repository browser.