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