]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | Copyright (c) 2005-2006 Dan Marsden | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ==============================================================================*/ | |
8 | #if !defined(FUSION_ADVANCE_IMPL_13122005_1906) | |
9 | #define FUSION_ADVANCE_IMPL_13122005_1906 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/iterator/advance.hpp> | |
13 | ||
14 | namespace boost { namespace fusion | |
15 | { | |
16 | struct transform_view_iterator_tag; | |
17 | struct transform_view_iterator2_tag; | |
18 | ||
19 | template<typename First, typename F> | |
20 | struct transform_view_iterator; | |
21 | ||
22 | template <typename First1, typename First2, typename F> | |
23 | struct transform_view_iterator2; | |
24 | ||
25 | namespace extension | |
26 | { | |
27 | template<typename Tag> | |
28 | struct advance_impl; | |
29 | ||
30 | // Unary Version | |
31 | template<> | |
32 | struct advance_impl<transform_view_iterator_tag> | |
33 | { | |
34 | template<typename Iterator, typename Dist> | |
35 | struct apply | |
36 | { | |
37 | typedef typename Iterator::first_type first_type; | |
38 | typedef typename result_of::advance<first_type, Dist>::type advanced_type; | |
39 | typedef typename Iterator::transform_type transform_type; | |
40 | typedef transform_view_iterator<advanced_type, transform_type> type; | |
41 | ||
42 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
43 | static type | |
44 | call(Iterator const& i) | |
45 | { | |
46 | return type(boost::fusion::advance<Dist>(i.first), i.f); | |
47 | } | |
48 | }; | |
49 | }; | |
50 | ||
51 | // Binary Version | |
52 | template<> | |
53 | struct advance_impl<transform_view_iterator2_tag> | |
54 | { | |
55 | template<typename Iterator, typename Dist> | |
56 | struct apply | |
57 | { | |
58 | typedef typename Iterator::first1_type first1_type; | |
59 | typedef typename Iterator::first2_type first2_type; | |
60 | typedef typename result_of::advance<first1_type, Dist>::type advanced1_type; | |
61 | typedef typename result_of::advance<first2_type, Dist>::type advanced2_type; | |
62 | typedef typename Iterator::transform_type transform_type; | |
63 | typedef transform_view_iterator2<advanced1_type, advanced2_type, transform_type> type; | |
64 | ||
65 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
66 | static type | |
67 | call(Iterator const& i) | |
68 | { | |
69 | return type( | |
70 | boost::fusion::advance<Dist>(i.first1) | |
71 | , boost::fusion::advance<Dist>(i.first2), i.f); | |
72 | } | |
73 | }; | |
74 | }; | |
75 | } | |
76 | }} | |
77 | ||
78 | #endif |