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