zhangmeng
2021-07-02 056f71f24cefaf88f2a93714c6678c03ed5f1e0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*=============================================================================
    Copyright (c) 2001-2011 Joel de Guzman
 
    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM)
#define BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM
 
#if defined(_MSC_VER)
#pragma once
#endif
 
#include <boost/mpl/bool.hpp>
#include <boost/fusion/include/equal_to.hpp>
#include <boost/fusion/include/next.hpp>
#include <boost/fusion/include/deref.hpp>
#include <boost/fusion/include/begin.hpp>
#include <boost/fusion/include/end.hpp>
#include <boost/fusion/include/any.hpp>
#include <boost/spirit/home/support/unused.hpp>
 
namespace boost { namespace spirit
{
    // A non-short circuiting (ns) strict order (so) version of the any
    // algorithm
 
    namespace detail
    {
        template <typename First1, typename Last, typename First2, typename F>
        inline bool
        any_ns_so(First1 const&, First2 const&, Last const&, F const&, mpl::true_)
        {
            return false;
        }
 
        template <typename First1, typename Last, typename First2, typename F>
        inline bool
        any_ns_so(First1 const& first1, First2 const& first2, Last const& last, F& f, mpl::false_)
        {
            bool head = f(*first1, *first2);
            bool tail =
                detail::any_ns_so(
                    fusion::next(first1)
                  , fusion::next(first2)
                  , last
                  , f
                  , fusion::result_of::equal_to<
                        typename fusion::result_of::next<First1>::type, Last>());
            return head || tail;
        }
 
        template <typename First, typename Last, typename F>
        inline bool
        any_ns_so(First const&, Last const&, F const&, mpl::true_)
        {
            return false;
        }
 
        template <typename First, typename Last, typename F>
        inline bool
        any_ns_so(First const& first, Last const& last, F& f, mpl::false_)
        {
            bool head = f(*first);
            bool tail =
                detail::any_ns_so(
                    fusion::next(first)
                  , last
                  , f
                  , fusion::result_of::equal_to<
                        typename fusion::result_of::next<First>::type, Last>());
            return head || tail;
        }
    }
 
    template <typename Sequence1, typename Sequence2, typename F>
    inline bool
    any_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f)
    {
        return detail::any_ns_so(
                fusion::begin(seq1)
              , fusion::begin(seq2)
              , fusion::end(seq1)
              , f
              , fusion::result_of::equal_to<
                    typename fusion::result_of::begin<Sequence1>::type
                  , typename fusion::result_of::end<Sequence1>::type>());
    }
 
    template <typename Sequence, typename F>
    inline bool
    any_ns_so(Sequence const& seq, unused_type, F f)
    {
        return detail::any_ns_so(
                fusion::begin(seq)
              , fusion::end(seq)
              , f
              , fusion::result_of::equal_to<
                    typename fusion::result_of::begin<Sequence>::type
                  , typename fusion::result_of::end<Sequence>::type>());
    }
 
}}
 
#endif