Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:48

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM)
0008 #define BOOST_SPIRIT_ANY_NS_SO_DECEMBER_03_2017_0826PM
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     // A non-short circuiting (ns) strict order (so) version of the any
0026     // algorithm
0027 
0028     namespace detail
0029     {
0030         template <typename First1, typename Last, typename First2, typename F>
0031         inline bool
0032         any_ns_so(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_so(First1 const& first1, First2 const& first2, Last const& last, F& f, mpl::false_)
0040         {
0041             bool head = f(*first1, *first2);
0042             bool tail =
0043                 detail::any_ns_so(
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             return head || tail;
0051         }
0052 
0053         template <typename First, typename Last, typename F>
0054         inline bool
0055         any_ns_so(First const&, Last const&, F const&, mpl::true_)
0056         {
0057             return false;
0058         }
0059 
0060         template <typename First, typename Last, typename F>
0061         inline bool
0062         any_ns_so(First const& first, Last const& last, F& f, mpl::false_)
0063         {
0064             bool head = f(*first);
0065             bool tail =
0066                 detail::any_ns_so(
0067                     fusion::next(first)
0068                   , last
0069                   , f
0070                   , fusion::result_of::equal_to<
0071                         typename fusion::result_of::next<First>::type, Last>());
0072             return head || tail;
0073         }
0074     }
0075 
0076     template <typename Sequence1, typename Sequence2, typename F>
0077     inline bool
0078     any_ns_so(Sequence1 const& seq1, Sequence2& seq2, F f)
0079     {
0080         return detail::any_ns_so(
0081                 fusion::begin(seq1)
0082               , fusion::begin(seq2)
0083               , fusion::end(seq1)
0084               , f
0085               , fusion::result_of::equal_to<
0086                     typename fusion::result_of::begin<Sequence1>::type
0087                   , typename fusion::result_of::end<Sequence1>::type>());
0088     }
0089 
0090     template <typename Sequence, typename F>
0091     inline bool
0092     any_ns_so(Sequence const& seq, unused_type, F f)
0093     {
0094         return detail::any_ns_so(
0095                 fusion::begin(seq)
0096               , fusion::end(seq)
0097               , f
0098               , fusion::result_of::equal_to<
0099                     typename fusion::result_of::begin<Sequence>::type
0100                   , typename fusion::result_of::end<Sequence>::type>());
0101     }
0102 
0103 }}
0104 
0105 #endif
0106