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_IS_SEGMENTED_HPP_INCLUDED) |
8 | #define BOOST_FUSION_ITERATOR_RANGE_IS_SEGMENTED_HPP_INCLUDED |
9 | |
10 | #include <boost/fusion/support/config.hpp> |
11 | #include <boost/mpl/assert.hpp> |
12 | #include <boost/mpl/bool.hpp> |
13 | |
14 | namespace boost { namespace fusion |
15 | { |
16 | struct iterator_range_tag; |
17 | |
18 | template <typename Context> |
19 | struct segmented_iterator; |
20 | |
21 | namespace extension |
22 | { |
23 | template <typename Tag> |
24 | struct is_segmented_impl; |
25 | |
26 | // An iterator_range of segmented_iterators is segmented |
27 | template <> |
28 | struct is_segmented_impl<iterator_range_tag> |
29 | { |
30 | private: |
31 | template <typename Iterator> |
32 | struct is_segmented_iterator |
33 | : mpl::false_ |
34 | {}; |
35 | |
36 | template <typename Iterator> |
37 | struct is_segmented_iterator<Iterator &> |
38 | : is_segmented_iterator<Iterator> |
39 | {}; |
40 | |
41 | template <typename Iterator> |
42 | struct is_segmented_iterator<Iterator const> |
43 | : is_segmented_iterator<Iterator> |
44 | {}; |
45 | |
46 | template <typename Context> |
47 | struct is_segmented_iterator<segmented_iterator<Context> > |
48 | : mpl::true_ |
49 | {}; |
50 | |
51 | public: |
52 | template <typename Sequence> |
53 | struct apply |
54 | : is_segmented_iterator<typename Sequence::begin_type> |
55 | { |
56 | BOOST_MPL_ASSERT_RELATION( |
57 | is_segmented_iterator<typename Sequence::begin_type>::value |
58 | , == |
59 | , is_segmented_iterator<typename Sequence::end_type>::value); |
60 | }; |
61 | }; |
62 | } |
63 | }} |
64 | |
65 | #endif |
66 | |
67 | |
68 | |