]>
Commit | Line | Data |
---|---|---|
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_PREV_IMPL_13122005_2110) | |
9 | #define FUSION_PREV_IMPL_13122005_2110 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/iterator/prior.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 prior_impl; | |
29 | ||
30 | // Unary Version | |
31 | template<> | |
32 | struct prior_impl<transform_view_iterator_tag> | |
33 | { | |
34 | template<typename Iterator> | |
35 | struct apply | |
36 | { | |
37 | typedef typename Iterator::first_type first_type; | |
38 | typedef typename result_of::prior<first_type>::type prior_type; | |
39 | typedef typename Iterator::transform_type transform_type; | |
40 | typedef transform_view_iterator<prior_type, transform_type> type; | |
41 | ||
42 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
43 | static type | |
44 | call(Iterator const& i) | |
45 | { | |
46 | return type(fusion::prior(i.first), i.f); | |
47 | } | |
48 | }; | |
49 | }; | |
50 | ||
51 | // Binary Version | |
52 | template<> | |
53 | struct prior_impl<transform_view_iterator2_tag> | |
54 | { | |
55 | template<typename Iterator> | |
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::prior<first1_type>::type prior1_type; | |
61 | typedef typename result_of::prior<first2_type>::type prior2_type; | |
62 | typedef typename Iterator::transform_type transform_type; | |
63 | typedef transform_view_iterator2<prior1_type, prior2_type, transform_type> type; | |
64 | ||
65 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
66 | static type | |
67 | call(Iterator const& i) | |
68 | { | |
69 | return type(fusion::prior(i.first1), fusion::prior(i.first2), i.f); | |
70 | } | |
71 | }; | |
72 | }; | |
73 | } | |
74 | }} | |
75 | ||
76 | #endif |