Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #if !defined(FUSION_BEGIN_IMPL_07162005_0115)
|
Chris@16
|
8 #define FUSION_BEGIN_IMPL_07162005_0115
|
Chris@16
|
9
|
Chris@101
|
10 #include <boost/fusion/support/config.hpp>
|
Chris@16
|
11 #include <boost/fusion/iterator/equal_to.hpp>
|
Chris@16
|
12 #include <boost/mpl/if.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost { namespace fusion
|
Chris@16
|
15 {
|
Chris@16
|
16 struct joint_view_tag;
|
Chris@16
|
17
|
Chris@16
|
18 template <typename Category, typename First, typename Last, typename Concat>
|
Chris@16
|
19 struct joint_view_iterator;
|
Chris@16
|
20
|
Chris@16
|
21 namespace extension
|
Chris@16
|
22 {
|
Chris@16
|
23 template <typename Tag>
|
Chris@16
|
24 struct begin_impl;
|
Chris@16
|
25
|
Chris@16
|
26 template <>
|
Chris@16
|
27 struct begin_impl<joint_view_tag>
|
Chris@16
|
28 {
|
Chris@16
|
29 template <typename Sequence>
|
Chris@16
|
30 struct apply
|
Chris@16
|
31 {
|
Chris@16
|
32 typedef typename Sequence::first_type first_type;
|
Chris@16
|
33 typedef typename Sequence::last_type last_type;
|
Chris@16
|
34 typedef typename Sequence::concat_type concat_type;
|
Chris@16
|
35 typedef typename Sequence::category category;
|
Chris@16
|
36 typedef result_of::equal_to<first_type, last_type> equal_to;
|
Chris@16
|
37
|
Chris@16
|
38 typedef typename
|
Chris@16
|
39 mpl::if_<
|
Chris@16
|
40 equal_to
|
Chris@16
|
41 , concat_type
|
Chris@16
|
42 , joint_view_iterator<category, first_type, last_type, concat_type>
|
Chris@16
|
43 >::type
|
Chris@16
|
44 type;
|
Chris@16
|
45
|
Chris@101
|
46 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
Chris@16
|
47 static type
|
Chris@16
|
48 call(Sequence& s, mpl::true_)
|
Chris@16
|
49 {
|
Chris@16
|
50 return s.concat();
|
Chris@16
|
51 }
|
Chris@16
|
52
|
Chris@101
|
53 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
Chris@16
|
54 static type
|
Chris@16
|
55 call(Sequence& s, mpl::false_)
|
Chris@16
|
56 {
|
Chris@16
|
57 return type(s.first(), s.concat());
|
Chris@16
|
58 }
|
Chris@16
|
59
|
Chris@101
|
60 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
Chris@16
|
61 static type
|
Chris@16
|
62 call(Sequence& s)
|
Chris@16
|
63 {
|
Chris@16
|
64 return call(s, equal_to());
|
Chris@16
|
65 }
|
Chris@16
|
66 };
|
Chris@16
|
67 };
|
Chris@16
|
68 }
|
Chris@16
|
69 }}
|
Chris@16
|
70
|
Chris@16
|
71 #endif
|