[857] | 1 | /*=============================================================================
|
---|
| 2 | Copyright (c) 2003 Joel de Guzman
|
---|
| 3 | Copyright (c) 2004 Peder Holt
|
---|
| 4 | Copyright (c) 2005 Eric Niebler
|
---|
| 5 |
|
---|
| 6 | Use, modification and distribution is subject to the Boost Software
|
---|
| 7 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 8 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 9 | ==============================================================================*/
|
---|
| 10 | #if !defined(FUSION_ALGORITHM_ANY_HPP)
|
---|
| 11 | #define FUSION_ALGORITHM_ANY_HPP
|
---|
| 12 |
|
---|
| 13 | #include <boost/spirit/fusion/sequence/begin.hpp>
|
---|
| 14 | #include <boost/spirit/fusion/sequence/end.hpp>
|
---|
| 15 | #include <boost/spirit/fusion/iterator/equal_to.hpp>
|
---|
| 16 | #include <boost/spirit/fusion/algorithm/detail/any.ipp>
|
---|
| 17 |
|
---|
| 18 | namespace boost { namespace fusion
|
---|
| 19 | {
|
---|
| 20 | namespace meta
|
---|
| 21 | {
|
---|
| 22 | template <typename Sequence, typename F>
|
---|
| 23 | struct any
|
---|
| 24 | {
|
---|
| 25 | typedef bool type;
|
---|
| 26 | };
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | namespace function
|
---|
| 30 | {
|
---|
| 31 | struct any
|
---|
| 32 | {
|
---|
| 33 | template <typename Sequence, typename F>
|
---|
| 34 | struct apply
|
---|
| 35 | {
|
---|
| 36 | typedef bool type;
|
---|
| 37 | };
|
---|
| 38 |
|
---|
| 39 | template <typename Sequence, typename F>
|
---|
| 40 | inline bool
|
---|
| 41 | operator()(Sequence const& seq, F const& f) const
|
---|
| 42 | {
|
---|
| 43 | return detail::any(
|
---|
| 44 | fusion::begin(seq)
|
---|
| 45 | , fusion::end(seq)
|
---|
| 46 | , f
|
---|
| 47 | , meta::equal_to<
|
---|
| 48 | BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
---|
| 49 | , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | template <typename Sequence, typename F>
|
---|
| 53 | inline bool
|
---|
| 54 | operator()(Sequence& seq, F const& f) const
|
---|
| 55 | {
|
---|
| 56 | return detail::any(
|
---|
| 57 | fusion::begin(seq)
|
---|
| 58 | , fusion::end(seq)
|
---|
| 59 | , f
|
---|
| 60 | , meta::equal_to<
|
---|
| 61 | BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
---|
| 62 | , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
---|
| 63 | }
|
---|
| 64 | };
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | function::any const any = function::any();
|
---|
| 68 | }}
|
---|
| 69 |
|
---|
| 70 | #endif
|
---|
| 71 |
|
---|