[857] | 1 | /*=============================================================================
|
---|
| 2 | Copyright (c) 2003 Joel de Guzman
|
---|
| 3 |
|
---|
| 4 | Use, modification and distribution is subject to the Boost Software
|
---|
| 5 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 6 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 7 | ==============================================================================*/
|
---|
| 8 | #if !defined(FUSION_ALGORITHM_FILTER_HPP)
|
---|
| 9 | #define FUSION_ALGORITHM_FILTER_HPP
|
---|
| 10 |
|
---|
| 11 | #include <boost/spirit/fusion/sequence/filter_view.hpp>
|
---|
| 12 |
|
---|
| 13 | namespace boost { namespace fusion
|
---|
| 14 | {
|
---|
| 15 | namespace meta
|
---|
| 16 | {
|
---|
| 17 | template <typename Sequence, typename Pred>
|
---|
| 18 | struct filter
|
---|
| 19 | {
|
---|
| 20 | typedef filter_view<Sequence, Pred> type;
|
---|
| 21 | };
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | namespace function
|
---|
| 25 | {
|
---|
| 26 | struct filter
|
---|
| 27 | {
|
---|
| 28 | template <typename Sequence, typename Pred>
|
---|
| 29 | struct apply : meta::filter<Sequence, Pred> {};
|
---|
| 30 |
|
---|
| 31 | template <typename Sequence, typename Pred>
|
---|
| 32 | typename apply<Sequence const, Pred>::type
|
---|
| 33 | operator()(Sequence const& seq, Pred) const
|
---|
| 34 | {
|
---|
| 35 | return filter_view<Sequence const, Pred>(seq);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | template <typename Sequence, typename Pred>
|
---|
| 39 | typename apply<Sequence, Pred>::type
|
---|
| 40 | operator()(Sequence& seq, Pred) const
|
---|
| 41 | {
|
---|
| 42 | return filter_view<Sequence, Pred>(seq);
|
---|
| 43 | }
|
---|
| 44 | };
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | function::filter const filter = function::filter();
|
---|
| 48 | }}
|
---|
| 49 |
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|