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