File indexing completed on 2025-01-19 09:47:47
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_SPIRIT_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM)
0009 #define BOOST_SPIRIT_ANY_IF_NS_SO_DECEMBER_03_2017_0826PM
0010
0011 #if defined(_MSC_VER)
0012 #pragma once
0013 #endif
0014
0015 #include <boost/spirit/home/support/algorithm/any_if.hpp>
0016 #include <boost/spirit/home/support/algorithm/any_ns_so.hpp>
0017
0018 namespace boost { namespace spirit
0019 {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 namespace detail
0031 {
0032 template <
0033 typename Pred, typename First1, typename Last1, typename First2
0034 , typename Last2, typename F
0035 >
0036 inline bool
0037 any_if_ns_so(First1 const&, First2 const&, Last1 const&, Last2 const&
0038 , F const&, mpl::true_)
0039 {
0040 return false;
0041 }
0042
0043 template <
0044 typename Pred, typename First1, typename Last1, typename First2
0045 , typename Last2, typename F
0046 >
0047 inline bool
0048 any_if_ns_so(First1 const& first1, First2 const& first2
0049 , Last1 const& last1, Last2 const& last2, F& f, mpl::false_)
0050 {
0051 typename result_of::attribute_value<First1, First2, Last2, Pred>::type
0052 attribute = spirit::detail::attribute_value<Pred, First1, Last2>(first2);
0053
0054 bool head = f(*first1, attribute);
0055 bool tail =
0056 detail::any_if_ns_so<Pred>(
0057 fusion::next(first1)
0058 , attribute_next<Pred, First1, Last2>(first2)
0059 , last1, last2
0060 , f
0061 , fusion::result_of::equal_to<
0062 typename fusion::result_of::next<First1>::type, Last1>());
0063 return head || tail;
0064 }
0065 }
0066
0067 template <typename Pred, typename Sequence1, typename Sequence2, typename F>
0068 inline bool
0069 any_if_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f, Pred)
0070 {
0071 return detail::any_if_ns_so<Pred>(
0072 fusion::begin(seq1), fusion::begin(seq2)
0073 , fusion::end(seq1), fusion::end(seq2)
0074 , f
0075 , fusion::result_of::equal_to<
0076 typename fusion::result_of::begin<Sequence1>::type
0077 , typename fusion::result_of::end<Sequence1>::type>());
0078 }
0079
0080 template <typename Pred, typename Sequence, typename F>
0081 inline bool
0082 any_if_ns_so(Sequence const& seq, unused_type const, F f, Pred)
0083 {
0084 return detail::any_ns_so(
0085 fusion::begin(seq)
0086 , fusion::end(seq)
0087 , f
0088 , fusion::result_of::equal_to<
0089 typename fusion::result_of::begin<Sequence>::type
0090 , typename fusion::result_of::end<Sequence>::type>());
0091 }
0092
0093 }}
0094
0095 #endif
0096