Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #if !defined(FUSION_BEGIN_IMPL_07162005_1031)
|
Chris@16
|
8 #define FUSION_BEGIN_IMPL_07162005_1031
|
Chris@16
|
9
|
Chris@101
|
10 #include <boost/fusion/support/config.hpp>
|
Chris@16
|
11 #include <boost/fusion/view/transform_view/transform_view_fwd.hpp>
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost { namespace fusion
|
Chris@16
|
14 {
|
Chris@16
|
15 template <typename First, typename F>
|
Chris@16
|
16 struct transform_view_iterator;
|
Chris@16
|
17
|
Chris@16
|
18 template <typename First1, typename First2, typename F>
|
Chris@16
|
19 struct transform_view_iterator2;
|
Chris@16
|
20
|
Chris@16
|
21 namespace extension
|
Chris@16
|
22 {
|
Chris@16
|
23 template <typename Tag>
|
Chris@16
|
24 struct begin_impl;
|
Chris@16
|
25
|
Chris@16
|
26 // Unary Version
|
Chris@16
|
27 template <>
|
Chris@16
|
28 struct begin_impl<transform_view_tag>
|
Chris@16
|
29 {
|
Chris@16
|
30 template <typename Sequence>
|
Chris@16
|
31 struct apply
|
Chris@16
|
32 {
|
Chris@16
|
33 typedef typename Sequence::first_type first_type;
|
Chris@16
|
34 typedef typename Sequence::transform_type transform_type;
|
Chris@16
|
35 typedef transform_view_iterator<first_type, transform_type> type;
|
Chris@16
|
36
|
Chris@101
|
37 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
Chris@16
|
38 static type
|
Chris@16
|
39 call(Sequence& s)
|
Chris@16
|
40 {
|
Chris@16
|
41 return type(s.first(), s.f);
|
Chris@16
|
42 }
|
Chris@16
|
43 };
|
Chris@16
|
44 };
|
Chris@16
|
45
|
Chris@16
|
46 // Binary Version
|
Chris@16
|
47 template <>
|
Chris@16
|
48 struct begin_impl<transform_view2_tag>
|
Chris@16
|
49 {
|
Chris@16
|
50 template <typename Sequence>
|
Chris@16
|
51 struct apply
|
Chris@16
|
52 {
|
Chris@16
|
53 typedef typename Sequence::first1_type first1_type;
|
Chris@16
|
54 typedef typename Sequence::first2_type first2_type;
|
Chris@16
|
55 typedef typename Sequence::transform_type transform_type;
|
Chris@16
|
56 typedef transform_view_iterator2<first1_type, first2_type, transform_type> type;
|
Chris@16
|
57
|
Chris@101
|
58 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
Chris@16
|
59 static type
|
Chris@16
|
60 call(Sequence& s)
|
Chris@16
|
61 {
|
Chris@16
|
62 return type(s.first1(), s.first2(), s.f);
|
Chris@16
|
63 }
|
Chris@16
|
64 };
|
Chris@16
|
65 };
|
Chris@16
|
66 }
|
Chris@16
|
67 }}
|
Chris@16
|
68
|
Chris@16
|
69 #endif
|
Chris@16
|
70
|
Chris@16
|
71
|