1 | /*=============================================================================
|
---|
2 | Copyright (c) 2003 Joel de Guzman
|
---|
3 | Copyright (c) 2004 Peder Holt
|
---|
4 |
|
---|
5 | Use, modification and distribution is subject to the Boost Software
|
---|
6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
7 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
8 | ==============================================================================*/
|
---|
9 | #if !defined(FUSION_SEQUENCE_TRANSFORM_VIEW_HPP)
|
---|
10 | #define FUSION_SEQUENCE_TRANSFORM_VIEW_HPP
|
---|
11 |
|
---|
12 | #include <boost/spirit/fusion/detail/access.hpp>
|
---|
13 | #include <boost/spirit/fusion/iterator/transform_view_iterator.hpp>
|
---|
14 | #include <boost/spirit/fusion/sequence/detail/trsfrm_view_begin_end_trts.hpp>
|
---|
15 | #include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
|
---|
16 | #include <boost/spirit/fusion/sequence/begin.hpp>
|
---|
17 | #include <boost/spirit/fusion/sequence/end.hpp>
|
---|
18 |
|
---|
19 | namespace boost { namespace fusion
|
---|
20 | {
|
---|
21 | struct transform_view_tag;
|
---|
22 |
|
---|
23 | template <typename Sequence, typename F>
|
---|
24 | struct transform_view : sequence_base<transform_view<Sequence, F> >
|
---|
25 | {
|
---|
26 | typedef as_fusion_sequence<Sequence> seq_converter;
|
---|
27 | typedef typename seq_converter::type seq;
|
---|
28 |
|
---|
29 | typedef transform_view_tag tag;
|
---|
30 | typedef typename meta::begin<seq>::type first_type;
|
---|
31 | typedef typename meta::end<seq>::type last_type;
|
---|
32 | typedef F transform_type;
|
---|
33 |
|
---|
34 | transform_view(Sequence& seq, F f);
|
---|
35 |
|
---|
36 | first_type first;
|
---|
37 | last_type last;
|
---|
38 | transform_type f;
|
---|
39 | };
|
---|
40 |
|
---|
41 | template <typename Sequence, typename F>
|
---|
42 | transform_view<Sequence,F>::transform_view(Sequence& seq, F f)
|
---|
43 | : first(fusion::begin(seq))
|
---|
44 | , last(fusion::end(seq))
|
---|
45 | , f(f)
|
---|
46 | {}
|
---|
47 | }}
|
---|
48 |
|
---|
49 | #endif
|
---|
50 |
|
---|
51 |
|
---|