1
2#ifndef BOOST_MPL_STABLE_PARTITION_HPP_INCLUDED
3#define BOOST_MPL_STABLE_PARTITION_HPP_INCLUDED
4
5// Copyright Eric Friedman 2002-2003
6// Copyright Aleksey Gurtovoy 2004
7//
8// Distributed under the Boost Software License, Version 1.0.
9// (See accompanying file LICENSE_1_0.txt or copy at
10// http://www.boost.org/LICENSE_1_0.txt)
11//
12// See http://www.boost.org/libs/mpl for documentation.
13
14// $Id$
15// $Date$
16// $Revision$
17
18#include <boost/mpl/fold.hpp>
19#include <boost/mpl/reverse_fold.hpp>
20#include <boost/mpl/protect.hpp>
21#include <boost/mpl/aux_/partition_op.hpp>
22#include <boost/mpl/aux_/inserter_algorithm.hpp>
23#include <boost/mpl/aux_/na.hpp>
24
25namespace boost { namespace mpl {
26
27namespace aux {
28
29template <
30 typename Sequence
31 , typename Pred
32 , typename In
33 , typename In2
34 , typename In1 = typename if_na<In,In2>::type
35 >
36struct stable_partition_impl
37 : fold<
38 Sequence
39 , pair< typename In1::state, typename In2::state >
40 , protect< partition_op<
41 Pred
42 , typename In1::operation
43 , typename In2::operation
44 > >
45 >
46{
47};
48
49template <
50 typename Sequence
51 , typename Pred
52 , typename In
53 , typename In2
54 , typename In1 = typename if_na<In,In2>::type
55 >
56struct reverse_stable_partition_impl
57 : reverse_fold<
58 Sequence
59 , pair< typename In1::state, typename In2::state >
60 , protect< partition_op<
61 Pred
62 , typename In1::operation
63 , typename In2::operation
64 > >
65 >
66{
67};
68
69} // namespace aux
70
71BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, stable_partition)
72
73}}
74
75#endif // BOOST_MPL_STABLE_PARTITION_HPP_INCLUDED
76

source code of include/boost/mpl/stable_partition.hpp