File indexing completed on 2025-01-18 09:53:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_ANY_HPP_EAN_11_19_2005
0009 #define BOOST_XPRESSIVE_DETAIL_UTILITY_ANY_HPP_EAN_11_19_2005
0010
0011 #include <boost/version.hpp>
0012
0013 #if BOOST_VERSION >= 103300
0014
0015
0016
0017 # if BOOST_VERSION >= 103500
0018 # include <boost/fusion/include/any.hpp> // Boost 1.35+ has Fusion2
0019 # else
0020 # include <boost/spirit/fusion/algorithm/any.hpp> // Fusion1
0021 # endif
0022
0023 #else
0024
0025 # include <boost/spirit/fusion/sequence/begin.hpp>
0026 # include <boost/spirit/fusion/sequence/end.hpp>
0027 # include <boost/spirit/fusion/iterator/equal_to.hpp>
0028 # include <boost/mpl/bool.hpp>
0029 # include <boost/spirit/fusion/iterator/equal_to.hpp>
0030 # include <boost/spirit/fusion/iterator/next.hpp>
0031 # include <boost/spirit/fusion/iterator/deref.hpp>
0032
0033 namespace boost { namespace fusion
0034 {
0035
0036 namespace detail
0037 {
0038 template <typename First, typename Last, typename F>
0039 inline bool
0040 any(First const&, Last const&, F const&, mpl::true_)
0041 {
0042 return false;
0043 }
0044
0045 template <typename First, typename Last, typename F>
0046 inline bool
0047 any(First const& first, Last const& last, F const& f, mpl::false_)
0048 {
0049 if(f(*first))
0050 return true;
0051 return detail::any(fusion::next(first), last, f
0052 , meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>());
0053 }
0054 }
0055
0056 namespace meta
0057 {
0058 template <typename Sequence, typename F>
0059 struct any
0060 {
0061 typedef bool type;
0062 };
0063 }
0064
0065 namespace function
0066 {
0067 struct any
0068 {
0069 template <typename Sequence, typename F>
0070 struct apply
0071 {
0072 typedef bool type;
0073 };
0074
0075 template <typename Sequence, typename F>
0076 inline bool
0077 operator()(Sequence const& seq, F const& f) const
0078 {
0079 return detail::any(
0080 fusion::begin(seq)
0081 , fusion::end(seq)
0082 , f
0083 , meta::equal_to<
0084 BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
0085 , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
0086 }
0087
0088 template <typename Sequence, typename F>
0089 inline bool
0090 operator()(Sequence& seq, F const& f) const
0091 {
0092 return detail::any(
0093 fusion::begin(seq)
0094 , fusion::end(seq)
0095 , f
0096 , meta::equal_to<
0097 BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
0098 , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
0099 }
0100 };
0101 }
0102
0103 function::any const any = function::any();
0104 }}
0105
0106 #endif
0107
0108 #endif