[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_TRANSFORM_HPP)
|
---|
| 9 | #define FUSION_ALGORITHM_TRANSFORM_HPP
|
---|
| 10 |
|
---|
| 11 | #include <boost/spirit/fusion/sequence/transform_view.hpp>
|
---|
| 12 |
|
---|
| 13 | namespace boost { namespace fusion
|
---|
| 14 | {
|
---|
| 15 | namespace meta
|
---|
| 16 | {
|
---|
| 17 | template <typename Sequence, typename F>
|
---|
| 18 | struct transform
|
---|
| 19 | {
|
---|
| 20 | typedef transform_view<Sequence, F> type;
|
---|
| 21 | };
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | namespace function
|
---|
| 25 | {
|
---|
| 26 | struct transform
|
---|
| 27 | {
|
---|
| 28 | template <typename Sequence, typename F>
|
---|
| 29 | struct apply : meta::transform<Sequence, F> {};
|
---|
| 30 |
|
---|
| 31 | template <typename Sequence, typename F>
|
---|
| 32 | typename apply<Sequence const, F>::type
|
---|
| 33 | operator()(Sequence const& seq, F const& f) const
|
---|
| 34 | {
|
---|
| 35 | return transform_view<Sequence const, F>(seq, f);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | template <typename Sequence, typename F>
|
---|
| 39 | typename apply<Sequence, F>::type
|
---|
| 40 | operator()(Sequence& seq, F const& f) const
|
---|
| 41 | {
|
---|
| 42 | return transform_view<Sequence, F>(seq, f);
|
---|
| 43 | }
|
---|
| 44 | };
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | function::transform const transform = function::transform();
|
---|
| 48 |
|
---|
| 49 | }}
|
---|
| 50 |
|
---|
| 51 | #endif
|
---|
| 52 |
|
---|