[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_SEQUENCE_DETAIL_TRANSFORM_VIEW_BEGIN_END_TRAITS_HPP)
|
---|
| 9 | #define FUSION_SEQUENCE_DETAIL_TRANSFORM_VIEW_BEGIN_END_TRAITS_HPP
|
---|
| 10 |
|
---|
| 11 | #include <boost/spirit/fusion/detail/config.hpp>
|
---|
| 12 |
|
---|
| 13 | namespace boost { namespace fusion
|
---|
| 14 | {
|
---|
| 15 | struct transform_view_tag;
|
---|
| 16 |
|
---|
| 17 | template <typename Sequence, typename F>
|
---|
| 18 | struct transform_view;
|
---|
| 19 |
|
---|
| 20 | template <typename First, typename F>
|
---|
| 21 | struct transform_view_iterator;
|
---|
| 22 |
|
---|
| 23 | namespace meta
|
---|
| 24 | {
|
---|
| 25 | template <typename Tag>
|
---|
| 26 | struct begin_impl;
|
---|
| 27 |
|
---|
| 28 | template <>
|
---|
| 29 | struct begin_impl<transform_view_tag>
|
---|
| 30 | {
|
---|
| 31 | template <typename Sequence>
|
---|
| 32 | struct apply
|
---|
| 33 | {
|
---|
| 34 | typedef typename Sequence::first_type first_type;
|
---|
| 35 | typedef typename Sequence::transform_type transform_type;
|
---|
| 36 | typedef transform_view_iterator<first_type, transform_type> type;
|
---|
| 37 |
|
---|
| 38 | static type
|
---|
| 39 | call(Sequence& s)
|
---|
| 40 | {
|
---|
| 41 | return type(s.first, s.f);
|
---|
| 42 | }
|
---|
| 43 | };
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | template <typename Tag>
|
---|
| 47 | struct end_impl;
|
---|
| 48 |
|
---|
| 49 | template <>
|
---|
| 50 | struct end_impl<transform_view_tag>
|
---|
| 51 | {
|
---|
| 52 | template <typename Sequence>
|
---|
| 53 | struct apply
|
---|
| 54 | {
|
---|
| 55 | typedef typename Sequence::last_type last_type;
|
---|
| 56 | typedef typename Sequence::transform_type transform_type;
|
---|
| 57 | typedef transform_view_iterator<last_type, transform_type> type;
|
---|
| 58 |
|
---|
| 59 | static type
|
---|
| 60 | call(Sequence& s)
|
---|
| 61 | {
|
---|
| 62 | return type(s.last, s.f);
|
---|
| 63 | }
|
---|
| 64 | };
|
---|
| 65 | };
|
---|
| 66 | }
|
---|
| 67 | }}
|
---|
| 68 |
|
---|
| 69 | namespace boost { namespace mpl
|
---|
| 70 | {
|
---|
| 71 | template <typename Tag>
|
---|
| 72 | struct begin_impl;
|
---|
| 73 |
|
---|
| 74 | template <typename Tag>
|
---|
| 75 | struct end_impl;
|
---|
| 76 |
|
---|
| 77 | template <>
|
---|
| 78 | struct begin_impl<fusion::transform_view_tag>
|
---|
| 79 | : fusion::meta::begin_impl<fusion::transform_view_tag> {};
|
---|
| 80 |
|
---|
| 81 | template <>
|
---|
| 82 | struct end_impl<fusion::transform_view_tag>
|
---|
| 83 | : fusion::meta::end_impl<fusion::transform_view_tag> {};
|
---|
| 84 | }}
|
---|
| 85 |
|
---|
| 86 | #endif
|
---|
| 87 |
|
---|
| 88 |
|
---|