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

Private GIT Repository
8f33c098b81ec3f757f37832a861ad7609b8fa95
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / iter_fold_if.hpp
1 \r
2 #ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED\r
3 #define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2003-2004\r
6 // Copyright Eric Friedman 2003\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: iter_fold_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/begin_end.hpp>\r
19 #include <boost/mpl/logical.hpp>\r
20 #include <boost/mpl/always.hpp>\r
21 #include <boost/mpl/eval_if.hpp>\r
22 #include <boost/mpl/if.hpp>\r
23 #include <boost/mpl/pair.hpp>\r
24 #include <boost/mpl/apply.hpp>\r
25 #include <boost/mpl/aux_/iter_fold_if_impl.hpp>\r
26 #include <boost/mpl/aux_/na_spec.hpp>\r
27 #include <boost/mpl/aux_/lambda_support.hpp>\r
28 #include <boost/mpl/aux_/config/forwarding.hpp>\r
29 #include <boost/mpl/aux_/config/workaround.hpp>\r
30 \r
31 #include <boost/type_traits/is_same.hpp>\r
32 \r
33 namespace boost { namespace mpl {\r
34 \r
35 namespace aux {\r
36 \r
37 template< typename Predicate, typename LastIterator >\r
38 struct iter_fold_if_pred\r
39 {\r
40     template< typename State, typename Iterator > struct apply\r
41 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)\r
42         : and_<\r
43               not_< is_same<Iterator,LastIterator> >\r
44             , apply1<Predicate,Iterator>\r
45             >\r
46     {\r
47 #else\r
48     {\r
49         typedef and_<\r
50               not_< is_same<Iterator,LastIterator> >\r
51             , apply1<Predicate,Iterator>\r
52             > type;\r
53 #endif\r
54     };\r
55 };\r
56 \r
57 } // namespace aux\r
58 \r
59 template<\r
60       typename BOOST_MPL_AUX_NA_PARAM(Sequence)\r
61     , typename BOOST_MPL_AUX_NA_PARAM(State)\r
62     , typename BOOST_MPL_AUX_NA_PARAM(ForwardOp)\r
63     , typename BOOST_MPL_AUX_NA_PARAM(ForwardPredicate)\r
64     , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp)\r
65     , typename BOOST_MPL_AUX_NA_PARAM(BackwardPredicate)\r
66     >\r
67 struct iter_fold_if\r
68 {\r
69 \r
70     typedef typename begin<Sequence>::type first_;\r
71     typedef typename end<Sequence>::type last_;\r
72 \r
73     typedef typename eval_if<\r
74           is_na<BackwardPredicate>\r
75         , if_< is_na<BackwardOp>, always<false_>, always<true_> >\r
76         , identity<BackwardPredicate>\r
77         >::type backward_pred_;\r
78 \r
79 // cwpro8 doesn't like 'cut-off' type here (use typedef instead)\r
80 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))\r
81     struct result_ :\r
82 #else\r
83     typedef\r
84 #endif\r
85         aux::iter_fold_if_impl<\r
86           first_\r
87         , State\r
88         , ForwardOp\r
89         , protect< aux::iter_fold_if_pred< ForwardPredicate,last_ > >\r
90         , BackwardOp\r
91         , backward_pred_\r
92         >\r
93 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))\r
94     { };\r
95 #else\r
96     result_;\r
97 #endif\r
98 \r
99 public:\r
100 \r
101     typedef pair<\r
102           typename result_::state\r
103         , typename result_::iterator\r
104         > type;\r
105 \r
106     BOOST_MPL_AUX_LAMBDA_SUPPORT(\r
107           6\r
108         , iter_fold_if\r
109         , (Sequence,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate)\r
110         )\r
111 };\r
112 \r
113 BOOST_MPL_AUX_NA_SPEC(6, iter_fold_if)\r
114 \r
115 }}\r
116 \r
117 #endif // BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED\r