| 1 | /*============================================================================= |
| 2 | Copyright (c) 2006 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(FUSION_IS_SEGMENTED_03202006_0015) |
| 8 | #define FUSION_IS_SEGMENTED_03202006_0015 |
| 9 | |
| 10 | #include <boost/fusion/support/config.hpp> |
| 11 | #include <boost/mpl/bool.hpp> |
| 12 | #include <boost/fusion/support/tag_of.hpp> |
| 13 | |
| 14 | namespace boost { namespace fusion |
| 15 | { |
| 16 | // Special tags: |
| 17 | struct sequence_facade_tag; |
| 18 | struct iterator_range_tag; |
| 19 | |
| 20 | namespace extension |
| 21 | { |
| 22 | template <typename Tag> |
| 23 | struct is_segmented_impl |
| 24 | { |
| 25 | template <typename Sequence> |
| 26 | struct apply |
| 27 | : mpl::false_ |
| 28 | {}; |
| 29 | }; |
| 30 | |
| 31 | template <> |
| 32 | struct is_segmented_impl<sequence_facade_tag> |
| 33 | { |
| 34 | template <typename Sequence> |
| 35 | struct apply : Sequence::is_segmented {}; |
| 36 | }; |
| 37 | |
| 38 | template <> |
| 39 | struct is_segmented_impl<iterator_range_tag>; |
| 40 | } |
| 41 | |
| 42 | namespace traits |
| 43 | { |
| 44 | template <typename Sequence> |
| 45 | struct is_segmented |
| 46 | : mpl::bool_< |
| 47 | (bool)extension::is_segmented_impl<typename traits::tag_of<Sequence>::type>:: |
| 48 | template apply<Sequence>::type::value |
| 49 | > |
| 50 | { |
| 51 | }; |
| 52 | } |
| 53 | }} |
| 54 | |
| 55 | #endif |
| 56 | |