]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / sequence / intrinsic / detail / segmented_end_impl.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_END_IMPL_HPP_INCLUDED)
8 #define BOOST_FUSION_SEGMENTED_END_IMPL_HPP_INCLUDED
9
10 #include <boost/mpl/assert.hpp>
11 #include <boost/type_traits/add_const.hpp>
12 #include <boost/type_traits/remove_reference.hpp>
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
14 #include <boost/fusion/container/list/cons_fwd.hpp>
15 #include <boost/fusion/support/is_segmented.hpp>
16
17 namespace boost { namespace fusion
18 {
19     template <typename First, typename Last>
20     struct iterator_range;
21 }}
22
23 namespace boost { namespace fusion { namespace detail
24 {
25     //auto segmented_end_impl( seq, stack )
26     //{
27     //    assert(is_segmented(seq));
28     //    auto it = end(segments(seq));
29     //    return cons(iterator_range(it, it), stack);
30     //}
31
32     template <typename Sequence, typename Stack>
33     struct segmented_end_impl
34     {
35         BOOST_MPL_ASSERT((traits::is_segmented<Sequence>));
36
37         typedef
38             typename result_of::end<
39                 typename remove_reference<
40                     typename add_const<
41                         typename result_of::segments<Sequence>::type
42                     >::type
43                 >::type
44             >::type
45         end_type;
46
47         typedef iterator_range<end_type, end_type>  pair_type;
48         typedef cons<pair_type, Stack>              type;
49
50         static type call(Sequence & seq, Stack stack)
51         {
52             end_type end = fusion::end(fusion::segments(seq));
53             return type(pair_type(end, end), stack);
54         }
55     };
56
57 }}}
58
59 #endif