]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/view/joint_view/detail/begin_impl.hpp
Added error detection for cases such as a read's two mates having different names...
[rsem.git] / boost / fusion / view / joint_view / detail / begin_impl.hpp
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/iterator/equal_to.hpp>
11 #include <boost/mpl/if.hpp>
12
13 namespace boost { namespace fusion
14 {
15     struct joint_view_tag;
16
17     template <typename Category, typename First, typename Last, typename Concat>
18     struct joint_view_iterator;
19
20     namespace extension
21     {
22         template <typename Tag>
23         struct begin_impl;
24
25         template <>
26         struct begin_impl<joint_view_tag>
27         {
28             template <typename Sequence>
29             struct apply
30             {
31                 typedef typename Sequence::first_type first_type;
32                 typedef typename Sequence::last_type last_type;
33                 typedef typename Sequence::concat_type concat_type;
34                 typedef typename Sequence::category category;
35                 typedef result_of::equal_to<first_type, last_type> equal_to;
36
37                 typedef typename
38                     mpl::if_<
39                         equal_to
40                       , concat_type
41                       , joint_view_iterator<category, first_type, last_type, concat_type>
42                     >::type
43                 type;
44
45                 static type
46                 call(Sequence& s, mpl::true_)
47                 {
48                     return s.concat();
49                 }
50
51                 static type
52                 call(Sequence& s, mpl::false_)
53                 {
54                     return type(s.first(), s.concat());
55                 }
56
57                 static type
58                 call(Sequence& s)
59                 {
60                     return call(s, equal_to());
61                 }
62             };
63         };
64     }
65 }}
66
67 #endif