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_NEXT_IMPL_07162005_0136) |
8 | #define FUSION_NEXT_IMPL_07162005_0136 |
9 | |
10 | #include <boost/fusion/support/config.hpp> |
11 | #include <boost/fusion/iterator/next.hpp> |
12 | #include <boost/fusion/iterator/equal_to.hpp> |
13 | #include <boost/mpl/if.hpp> |
14 | |
15 | namespace boost { namespace fusion |
16 | { |
17 | struct joint_view_iterator_tag; |
18 | |
19 | template <typename Category, typename First, typename Last, typename Concat> |
20 | struct joint_view_iterator; |
21 | |
22 | namespace extension |
23 | { |
24 | template <typename Tag> |
25 | struct next_impl; |
26 | |
27 | template <> |
28 | struct next_impl<joint_view_iterator_tag> |
29 | { |
30 | template <typename Iterator> |
31 | struct apply |
32 | { |
33 | typedef typename Iterator::first_type first_type; |
34 | typedef typename Iterator::last_type last_type; |
35 | typedef typename Iterator::concat_type concat_type; |
36 | typedef typename Iterator::category category; |
37 | typedef typename result_of::next<first_type>::type next_type; |
38 | typedef result_of::equal_to<next_type, last_type> equal_to; |
39 | |
40 | typedef typename |
41 | mpl::if_< |
42 | equal_to |
43 | , concat_type |
44 | , joint_view_iterator<category, next_type, last_type, concat_type> |
45 | >::type |
46 | type; |
47 | |
48 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
49 | static type |
50 | call(Iterator const& i, mpl::true_) |
51 | { |
52 | return i.concat; |
53 | } |
54 | |
55 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
56 | static type |
57 | call(Iterator const& i, mpl::false_) |
58 | { |
59 | return type(fusion::next(i.first), i.concat); |
60 | } |
61 | |
62 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
63 | static type |
64 | call(Iterator const& i) |
65 | { |
66 | return call(i, equal_to()); |
67 | } |
68 | }; |
69 | }; |
70 | } |
71 | }} |
72 | |
73 | #endif |
74 | |
75 | |
76 | |