]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/fusion/support/config.hpp> | |
11 | #include <boost/mpl/assert.hpp> | |
12 | #include <boost/type_traits/add_const.hpp> | |
13 | #include <boost/type_traits/remove_reference.hpp> | |
14 | #include <boost/fusion/sequence/intrinsic_fwd.hpp> | |
15 | #include <boost/fusion/container/list/cons_fwd.hpp> | |
16 | #include <boost/fusion/support/is_segmented.hpp> | |
17 | ||
18 | namespace boost { namespace fusion | |
19 | { | |
20 | template <typename First, typename Last> | |
21 | struct iterator_range; | |
22 | }} | |
23 | ||
24 | namespace boost { namespace fusion { namespace detail | |
25 | { | |
26 | //auto segmented_end_impl( seq, stack ) | |
27 | //{ | |
28 | // assert(is_segmented(seq)); | |
29 | // auto it = end(segments(seq)); | |
30 | // return cons(iterator_range(it, it), stack); | |
31 | //} | |
32 | ||
33 | template <typename Sequence, typename Stack> | |
34 | struct segmented_end_impl | |
35 | { | |
36 | BOOST_MPL_ASSERT((traits::is_segmented<Sequence>)); | |
37 | ||
38 | typedef | |
39 | typename result_of::end< | |
40 | typename remove_reference< | |
41 | typename add_const< | |
42 | typename result_of::segments<Sequence>::type | |
43 | >::type | |
44 | >::type | |
45 | >::type | |
46 | end_type; | |
47 | ||
48 | typedef iterator_range<end_type, end_type> pair_type; | |
49 | typedef cons<pair_type, Stack> type; | |
50 | ||
51 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
52 | static pair_type make_pair(end_type end) | |
53 | { | |
54 | return pair_type(end, end); | |
55 | } | |
56 | ||
57 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
58 | static type call(Sequence & seq, Stack stack) | |
59 | { | |
60 | return type( | |
61 | make_pair(fusion::end(fusion::segments(seq))), | |
62 | stack); | |
63 | } | |
64 | }; | |
65 | ||
66 | }}} | |
67 | ||
68 | #endif |