Back to home page

EIC code displayed by LXR

 
 

    


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

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_APRIL_22_2006_1147AM)
0008 #define BOOST_SPIRIT_ANY_APRIL_22_2006_1147AM
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     // This is the binary version of fusion::any. This might
0026     // be a good candidate for inclusion in fusion algorithm
0027 
0028     namespace detail
0029     {
0030         template <typename First1, typename Last, typename First2, typename F>
0031         inline bool
0032         any(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(First1 const& first1, First2 const& first2, Last const& last, F& f, mpl::false_)
0040         {
0041             return f(*first1, *first2) ||
0042                 detail::any(
0043                     fusion::next(first1)
0044                   , fusion::next(first2)
0045                   , last
0046                   , f
0047                   , fusion::result_of::equal_to<
0048                         typename fusion::result_of::next<First1>::type, Last>());
0049         }
0050     }
0051 
0052     template <typename Sequence1, typename Sequence2, typename F>
0053     inline bool
0054     any(Sequence1 const& seq1, Sequence2& seq2, F f)
0055     {
0056         return detail::any(
0057                 fusion::begin(seq1)
0058               , fusion::begin(seq2)
0059               , fusion::end(seq1)
0060               , f
0061               , fusion::result_of::equal_to<
0062                     typename fusion::result_of::begin<Sequence1>::type
0063                   , typename fusion::result_of::end<Sequence1>::type>());
0064     }
0065 
0066     template <typename Sequence, typename F>
0067     inline bool
0068     any(Sequence const& seq, unused_type, F f)
0069     {
0070         return fusion::any(seq, f);
0071     }
0072 
0073 }}
0074 
0075 #endif
0076