Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/mpl/iter_fold_if.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 | |
2 #ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED | |
3 #define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED | |
4 | |
5 // Copyright Aleksey Gurtovoy 2003-2004 | |
6 // Copyright Eric Friedman 2003 | |
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: iter_fold_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ | |
15 // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ | |
16 // $Revision: 49267 $ | |
17 | |
18 #include <boost/mpl/begin_end.hpp> | |
19 #include <boost/mpl/logical.hpp> | |
20 #include <boost/mpl/always.hpp> | |
21 #include <boost/mpl/eval_if.hpp> | |
22 #include <boost/mpl/if.hpp> | |
23 #include <boost/mpl/pair.hpp> | |
24 #include <boost/mpl/apply.hpp> | |
25 #include <boost/mpl/aux_/iter_fold_if_impl.hpp> | |
26 #include <boost/mpl/aux_/na_spec.hpp> | |
27 #include <boost/mpl/aux_/lambda_support.hpp> | |
28 #include <boost/mpl/aux_/config/forwarding.hpp> | |
29 #include <boost/mpl/aux_/config/workaround.hpp> | |
30 | |
31 #include <boost/type_traits/is_same.hpp> | |
32 | |
33 namespace boost { namespace mpl { | |
34 | |
35 namespace aux { | |
36 | |
37 template< typename Predicate, typename LastIterator > | |
38 struct iter_fold_if_pred | |
39 { | |
40 template< typename State, typename Iterator > struct apply | |
41 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) | |
42 : and_< | |
43 not_< is_same<Iterator,LastIterator> > | |
44 , apply1<Predicate,Iterator> | |
45 > | |
46 { | |
47 #else | |
48 { | |
49 typedef and_< | |
50 not_< is_same<Iterator,LastIterator> > | |
51 , apply1<Predicate,Iterator> | |
52 > type; | |
53 #endif | |
54 }; | |
55 }; | |
56 | |
57 } // namespace aux | |
58 | |
59 template< | |
60 typename BOOST_MPL_AUX_NA_PARAM(Sequence) | |
61 , typename BOOST_MPL_AUX_NA_PARAM(State) | |
62 , typename BOOST_MPL_AUX_NA_PARAM(ForwardOp) | |
63 , typename BOOST_MPL_AUX_NA_PARAM(ForwardPredicate) | |
64 , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp) | |
65 , typename BOOST_MPL_AUX_NA_PARAM(BackwardPredicate) | |
66 > | |
67 struct iter_fold_if | |
68 { | |
69 | |
70 typedef typename begin<Sequence>::type first_; | |
71 typedef typename end<Sequence>::type last_; | |
72 | |
73 typedef typename eval_if< | |
74 is_na<BackwardPredicate> | |
75 , if_< is_na<BackwardOp>, always<false_>, always<true_> > | |
76 , identity<BackwardPredicate> | |
77 >::type backward_pred_; | |
78 | |
79 // cwpro8 doesn't like 'cut-off' type here (use typedef instead) | |
80 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) | |
81 struct result_ : | |
82 #else | |
83 typedef | |
84 #endif | |
85 aux::iter_fold_if_impl< | |
86 first_ | |
87 , State | |
88 , ForwardOp | |
89 , protect< aux::iter_fold_if_pred< ForwardPredicate,last_ > > | |
90 , BackwardOp | |
91 , backward_pred_ | |
92 > | |
93 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) | |
94 { }; | |
95 #else | |
96 result_; | |
97 #endif | |
98 | |
99 public: | |
100 | |
101 typedef pair< | |
102 typename result_::state | |
103 , typename result_::iterator | |
104 > type; | |
105 | |
106 BOOST_MPL_AUX_LAMBDA_SUPPORT( | |
107 6 | |
108 , iter_fold_if | |
109 , (Sequence,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate) | |
110 ) | |
111 }; | |
112 | |
113 BOOST_MPL_AUX_NA_SPEC(6, iter_fold_if) | |
114 | |
115 }} | |
116 | |
117 #endif // BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED |