]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/copy_if.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
ffe0110099562de2cc313916bdefcd78efd45013
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / copy_if.hpp
1 \r
2 #ifndef BOOST_MPL_COPY_IF_HPP_INCLUDED\r
3 #define BOOST_MPL_COPY_IF_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2000-2004\r
6 // Copyright David Abrahams 2003-2004\r
7 //\r
8 // Distributed under the Boost Software License, Version 1.0. \r
9 // (See accompanying file LICENSE_1_0.txt or copy at \r
10 // http://www.boost.org/LICENSE_1_0.txt)\r
11 //\r
12 // See http://www.boost.org/libs/mpl for documentation.\r
13 \r
14 // $Id: copy_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $\r
15 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $\r
16 // $Revision: 49267 $\r
17 \r
18 #include <boost/mpl/fold.hpp>\r
19 #include <boost/mpl/reverse_fold.hpp>\r
20 #include <boost/mpl/apply.hpp>\r
21 #include <boost/mpl/eval_if.hpp>\r
22 #include <boost/mpl/identity.hpp>\r
23 #include <boost/mpl/protect.hpp>\r
24 #include <boost/mpl/aux_/inserter_algorithm.hpp>\r
25 #include <boost/mpl/aux_/config/forwarding.hpp>\r
26 \r
27 namespace boost { namespace mpl {\r
28 \r
29 namespace aux {\r
30 \r
31 template<\r
32       typename Operation\r
33     , typename Predicate\r
34     >\r
35 struct copy_if_op\r
36 {\r
37     template< typename Sequence, typename T > struct apply\r
38 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)\r
39         : eval_if<\r
40               typename apply1<Predicate,T>::type\r
41             , apply2<Operation,Sequence,T>\r
42             , identity<Sequence>\r
43             >\r
44     {\r
45 #else\r
46     {\r
47         typedef typename eval_if<\r
48               typename apply1<Predicate,T>::type\r
49             , apply2<Operation,Sequence,T>\r
50             , identity<Sequence>\r
51             >::type type;\r
52 #endif\r
53     };\r
54 };\r
55 \r
56 template<\r
57       typename Sequence\r
58     , typename Predicate\r
59     , typename Inserter\r
60     >\r
61 struct copy_if_impl\r
62     : fold<\r
63           Sequence\r
64         , typename Inserter::state\r
65         , protect< aux::copy_if_op<\r
66               typename Inserter::operation\r
67             , Predicate\r
68             > >\r
69         >\r
70 {\r
71 };\r
72 \r
73 template<\r
74       typename Sequence\r
75     , typename Predicate\r
76     , typename Inserter\r
77     >\r
78 struct reverse_copy_if_impl\r
79     : reverse_fold<\r
80           Sequence\r
81         , typename Inserter::state\r
82         , protect< aux::copy_if_op<\r
83               typename Inserter::operation\r
84             , Predicate\r
85             > >\r
86         >\r
87 {\r
88 };\r
89 \r
90 } // namespace aux\r
91 \r
92 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, copy_if)\r
93 \r
94 }}\r
95 \r
96 #endif // BOOST_MPL_COPY_IF_HPP_INCLUDED\r