Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/test/stable_partition.cpp @ 20

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

added boost

File size: 1.2 KB
Line 
1
2// Copyright Aleksey Gurtovoy 2004
3// Copyright Eric Friedman 2003
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// $Source: /cvsroot/boost/boost/libs/mpl/test/stable_partition.cpp,v $
12// $Date: 2004/09/02 15:41:35 $
13// $Revision: 1.3 $
14
15#include <boost/mpl/stable_partition.hpp>
16
17#include <boost/mpl/vector_c.hpp>
18#include <boost/mpl/equal.hpp>
19#include <boost/mpl/comparison.hpp>
20#include <boost/mpl/int.hpp>
21#include <boost/mpl/aux_/test.hpp>
22
23typedef vector_c<int,3,4,0,-5,8,-1,7>::type numbers;
24typedef vector_c<int,0,-5,-1>::type manual_first;
25typedef vector_c<int,3,4,8,7>::type manual_second;
26
27MPL_TEST_CASE()
28{
29    typedef stable_partition<
30          numbers
31        , less< _, int_<3> >
32        >::type result;
33
34    MPL_ASSERT(( equal< result::first,manual_first > ));
35    MPL_ASSERT(( equal< result::second,manual_second > ));
36}
37
38MPL_TEST_CASE()
39{
40    typedef stable_partition<
41          numbers
42        , greater_equal< _, int_<3> >
43        >::type result;
44
45    MPL_ASSERT(( equal< result::first,manual_second > ));
46    MPL_ASSERT(( equal< result::second,manual_first > ));
47}
Note: See TracBrowser for help on using the repository browser.