]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/iterator/detail/segment_sequence.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / iterator / detail / segment_sequence.hpp
1 /*=============================================================================
2     Copyright (c) 2011 Eric Niebler
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(BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED)
8 #define BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED
9
10 #include <boost/mpl/bool.hpp>
11 #include <boost/type_traits/remove_reference.hpp>
12 #include <boost/fusion/support/tag_of.hpp>
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
14
15 namespace boost { namespace fusion { namespace detail
16 {
17     struct segment_sequence_tag {};
18
19     // Here, Sequence is a sequence of ranges (which may or may not be
20     // segmented).
21     template<typename Sequence>
22     struct segment_sequence
23         : sequence_base<segment_sequence<Sequence> >
24     {
25         typedef fusion_sequence_tag tag;
26         typedef segment_sequence_tag fusion_tag;
27         typedef typename Sequence::is_view is_view;
28         typedef typename Sequence::category category;
29         typedef Sequence sequence_type;
30         sequence_type sequence;
31
32         explicit segment_sequence(Sequence const & seq)
33             : sequence(seq)
34         {}
35     };
36 }
37
38 namespace extension
39 {
40     template<typename Tag>
41     struct is_segmented_impl;
42
43     template<>
44     struct is_segmented_impl<detail::segment_sequence_tag>
45     {
46         template<typename Sequence>
47         struct apply
48             : mpl::true_
49         {};
50     };
51
52     template<typename Tag>
53     struct segments_impl;
54
55     template<>
56     struct segments_impl<detail::segment_sequence_tag>
57     {
58         template<typename Sequence>
59         struct apply
60         {
61             typedef typename Sequence::sequence_type type;
62
63             static type call(Sequence & seq)
64             {
65                 return seq.sequence;
66             }
67         };
68     };
69 }}}
70
71 #endif