source: NonGTP/Boost/boost/mpl/aux_/partition_op.hpp @ 857

Revision 857, 1.5 KB checked in by igarcia, 18 years ago (diff)
Line 
1
2#ifndef BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED
3#define BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED
4
5// Copyright Eric Friedman 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// $Source: /cvsroot/boost/boost/boost/mpl/aux_/partition_op.hpp,v $
15// $Date: 2004/11/28 01:46:37 $
16// $Revision: 1.4 $
17
18#include <boost/mpl/apply.hpp>
19#include <boost/mpl/eval_if.hpp>
20#include <boost/mpl/if.hpp>
21#include <boost/mpl/pair.hpp>
22#include <boost/mpl/aux_/lambda_spec.hpp>
23
24namespace boost { namespace mpl {
25
26namespace aux {
27
28template< typename Pred, typename In1Op, typename In2Op >
29struct partition_op
30{
31    template< typename State, typename T >
32    struct apply
33    {
34        typedef typename State::first first_;
35        typedef typename State::second second_;
36        typedef typename apply1< Pred,T >::type pred_;
37
38        typedef typename eval_if<
39              pred_
40            , apply2<In1Op,first_,T>
41            , apply2<In2Op,second_,T>
42            >::type result_;
43
44        typedef typename if_<
45              pred_
46            , pair< result_,second_ >
47            , pair< first_,result_ >
48            >::type type;
49    };
50};
51
52} // namespace aux
53
54BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::partition_op)
55
56}}
57
58#endif // BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.