File indexing completed on 2025-01-18 09:41:56
0001
0002 #ifndef BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
0003 #define BOOST_MPL_ITER_FOLD_IF_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <boost/mpl/begin_end.hpp>
0019 #include <boost/mpl/logical.hpp>
0020 #include <boost/mpl/always.hpp>
0021 #include <boost/mpl/eval_if.hpp>
0022 #include <boost/mpl/if.hpp>
0023 #include <boost/mpl/pair.hpp>
0024 #include <boost/mpl/apply.hpp>
0025 #include <boost/mpl/aux_/iter_fold_if_impl.hpp>
0026 #include <boost/mpl/aux_/na_spec.hpp>
0027 #include <boost/mpl/aux_/lambda_support.hpp>
0028 #include <boost/mpl/aux_/config/forwarding.hpp>
0029 #include <boost/mpl/aux_/config/workaround.hpp>
0030
0031 #include <boost/type_traits/is_same.hpp>
0032
0033 namespace boost { namespace mpl {
0034
0035 namespace aux {
0036
0037 template< typename Predicate, typename LastIterator >
0038 struct iter_fold_if_pred
0039 {
0040 template< typename State, typename Iterator > struct apply
0041 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
0042 : and_<
0043 not_< is_same<Iterator,LastIterator> >
0044 , apply1<Predicate,Iterator>
0045 >
0046 {
0047 #else
0048 {
0049 typedef and_<
0050 not_< is_same<Iterator,LastIterator> >
0051 , apply1<Predicate,Iterator>
0052 > type;
0053 #endif
0054 };
0055 };
0056
0057 }
0058
0059 template<
0060 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0061 , typename BOOST_MPL_AUX_NA_PARAM(State)
0062 , typename BOOST_MPL_AUX_NA_PARAM(ForwardOp)
0063 , typename BOOST_MPL_AUX_NA_PARAM(ForwardPredicate)
0064 , typename BOOST_MPL_AUX_NA_PARAM(BackwardOp)
0065 , typename BOOST_MPL_AUX_NA_PARAM(BackwardPredicate)
0066 >
0067 struct iter_fold_if
0068 {
0069
0070 typedef typename begin<Sequence>::type first_;
0071 typedef typename end<Sequence>::type last_;
0072
0073 typedef typename eval_if<
0074 is_na<BackwardPredicate>
0075 , if_< is_na<BackwardOp>, always<false_>, always<true_> >
0076 , identity<BackwardPredicate>
0077 >::type backward_pred_;
0078
0079
0080 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
0081 struct result_ :
0082 #else
0083 typedef
0084 #endif
0085 aux::iter_fold_if_impl<
0086 first_
0087 , State
0088 , ForwardOp
0089 , protect< aux::iter_fold_if_pred< ForwardPredicate,last_ > >
0090 , BackwardOp
0091 , backward_pred_
0092 >
0093 #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) && !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
0094 { };
0095 #else
0096 result_;
0097 #endif
0098
0099 public:
0100
0101 typedef pair<
0102 typename result_::state
0103 , typename result_::iterator
0104 > type;
0105
0106 BOOST_MPL_AUX_LAMBDA_SUPPORT(
0107 6
0108 , iter_fold_if
0109 , (Sequence,State,ForwardOp,ForwardPredicate,BackwardOp,BackwardPredicate)
0110 )
0111 };
0112
0113 BOOST_MPL_AUX_NA_SPEC(6, iter_fold_if)
0114
0115 }}
0116
0117 #endif