]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/view/joint_view/detail/next_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 / next_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_NEXT_IMPL_07162005_0136)
8 #define FUSION_NEXT_IMPL_07162005_0136
9
10 #include <boost/fusion/iterator/next.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_iterator_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 next_impl;
25
26         template <>
27         struct next_impl<joint_view_iterator_tag>
28         {
29             template <typename Iterator>
30             struct apply
31             {
32                 typedef typename Iterator::first_type first_type;
33                 typedef typename Iterator::last_type last_type;
34                 typedef typename Iterator::concat_type concat_type;
35                 typedef typename Iterator::category category;
36                 typedef typename result_of::next<first_type>::type next_type;
37                 typedef result_of::equal_to<next_type, last_type> equal_to;
38
39                 typedef typename
40                     mpl::if_<
41                         equal_to
42                       , concat_type
43                       , joint_view_iterator<category, next_type, last_type, concat_type>
44                     >::type
45                 type;
46
47                 static type
48                 call(Iterator const& i, mpl::true_)
49                 {
50                     return i.concat;
51                 }
52
53                 static type
54                 call(Iterator const& i, mpl::false_)
55                 {
56                     return type(fusion::next(i.first), i.concat);
57                 }
58
59                 static type
60                 call(Iterator const& i)
61                 {
62                     return call(i, equal_to());
63                 }
64             };
65         };
66     }
67 }}
68
69 #endif
70
71