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_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED) |
8 | #define BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED |
9 | |
10 | #include <boost/fusion/support/config.hpp> |
11 | #include <boost/mpl/assert.hpp> |
12 | #include <boost/fusion/sequence/intrinsic/segments.hpp> |
13 | #include <boost/fusion/support/is_segmented.hpp> |
14 | #include <boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp> |
15 | |
16 | namespace boost { namespace fusion |
17 | { |
18 | struct iterator_range_tag; |
19 | |
20 | namespace extension |
21 | { |
22 | template <typename Tag> |
23 | struct segments_impl; |
24 | |
25 | template <> |
26 | struct segments_impl<iterator_range_tag> |
27 | { |
28 | template <typename Sequence> |
29 | struct apply |
30 | { |
31 | typedef |
32 | detail::make_segmented_range< |
33 | typename Sequence::begin_type |
34 | , typename Sequence::end_type |
35 | > |
36 | impl; |
37 | |
38 | BOOST_MPL_ASSERT((traits::is_segmented<typename impl::type>)); |
39 | |
40 | typedef |
41 | typename result_of::segments<typename impl::type>::type |
42 | type; |
43 | |
44 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
45 | static type call(Sequence & seq) |
46 | { |
47 | return fusion::segments(impl::call(seq.first, seq.last)); |
48 | } |
49 | }; |
50 | }; |
51 | } |
52 | }} |
53 | |
54 | #endif |
55 |