]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
92f5a8d4 | 3 | Copyright (c) 2018 Kohei Takahashi |
7c673cae FG |
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_DEREF_IMPL_07162005_1026) | |
9 | #define FUSION_DEREF_IMPL_07162005_1026 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
7c673cae | 12 | #include <boost/fusion/iterator/deref.hpp> |
92f5a8d4 | 13 | #include <boost/utility/result_of.hpp> |
7c673cae FG |
14 | |
15 | namespace boost { namespace fusion | |
16 | { | |
17 | struct transform_view_iterator_tag; | |
18 | struct transform_view_iterator2_tag; | |
19 | ||
20 | namespace extension | |
21 | { | |
22 | template <typename Tag> | |
23 | struct deref_impl; | |
24 | ||
25 | // Unary Version | |
26 | template <> | |
27 | struct deref_impl<transform_view_iterator_tag> | |
28 | { | |
29 | template <typename Iterator> | |
30 | struct apply | |
31 | { | |
32 | typedef typename | |
33 | result_of::deref<typename Iterator::first_type>::type | |
34 | value_type; | |
35 | ||
92f5a8d4 TL |
36 | typedef typename Iterator::transform_type F; |
37 | typedef typename boost::result_of<F(value_type)>::type type; | |
7c673cae FG |
38 | |
39 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
40 | static type | |
41 | call(Iterator const& i) | |
42 | { | |
43 | return i.f(*i.first); | |
44 | } | |
45 | }; | |
46 | }; | |
47 | ||
48 | // Binary Version | |
49 | template <> | |
50 | struct deref_impl<transform_view_iterator2_tag> | |
51 | { | |
52 | template <typename Iterator> | |
53 | struct apply | |
54 | { | |
55 | typedef typename | |
56 | result_of::deref<typename Iterator::first1_type>::type | |
57 | value1_type; | |
58 | typedef typename | |
59 | result_of::deref<typename Iterator::first2_type>::type | |
60 | value2_type; | |
61 | ||
92f5a8d4 TL |
62 | typedef typename Iterator::transform_type F; |
63 | typedef typename boost::result_of<F(value1_type, value2_type)>::type type; | |
7c673cae FG |
64 | |
65 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
66 | static type | |
67 | call(Iterator const& i) | |
68 | { | |
69 | return i.f(*i.first1, *i.first2); | |
70 | } | |
71 | }; | |
92f5a8d4 | 72 | }; |
7c673cae FG |
73 | } |
74 | }} | |
75 | ||
76 | #endif | |
77 | ||
78 |