Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2011 Joel de Guzman
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #if !defined(FUSION_IS_SEQUENCE_05052005_1002)
|
Chris@16
|
8 #define FUSION_IS_SEQUENCE_05052005_1002
|
Chris@16
|
9
|
Chris@101
|
10 #include <boost/fusion/support/config.hpp>
|
Chris@16
|
11 #include <boost/fusion/support/sequence_base.hpp>
|
Chris@16
|
12 #include <boost/fusion/support/tag_of.hpp>
|
Chris@16
|
13 #include <boost/mpl/is_sequence.hpp>
|
Chris@16
|
14 #include <boost/mpl/or.hpp>
|
Chris@16
|
15 #include <boost/mpl/bool.hpp>
|
Chris@16
|
16 #include <boost/type_traits/is_convertible.hpp>
|
Chris@16
|
17 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
18
|
Chris@16
|
19 namespace boost { namespace fusion
|
Chris@16
|
20 {
|
Chris@16
|
21 // Special tags:
|
Chris@16
|
22 struct non_fusion_tag;
|
Chris@16
|
23 struct boost_tuple_tag; // boost::tuples::tuple tag
|
Chris@16
|
24 struct boost_array_tag; // boost::array tag
|
Chris@16
|
25 struct mpl_sequence_tag; // mpl sequence tag
|
Chris@16
|
26 struct std_pair_tag; // std::pair tag
|
Chris@16
|
27
|
Chris@16
|
28 namespace extension
|
Chris@16
|
29 {
|
Chris@16
|
30 template <typename T>
|
Chris@16
|
31 struct is_sequence_impl
|
Chris@16
|
32 {
|
Chris@16
|
33 template <typename Sequence>
|
Chris@16
|
34 struct apply
|
Chris@101
|
35 : is_convertible<Sequence, fusion::detail::from_sequence_convertible_type>
|
Chris@16
|
36 {};
|
Chris@16
|
37 };
|
Chris@16
|
38
|
Chris@16
|
39 template <>
|
Chris@16
|
40 struct is_sequence_impl<non_fusion_tag>
|
Chris@16
|
41 {
|
Chris@16
|
42 template <typename T>
|
Chris@16
|
43 struct apply : mpl::false_ {};
|
Chris@16
|
44 };
|
Chris@16
|
45
|
Chris@16
|
46 template <>
|
Chris@16
|
47 struct is_sequence_impl<boost_tuple_tag>;
|
Chris@16
|
48
|
Chris@16
|
49 template <>
|
Chris@16
|
50 struct is_sequence_impl<boost_array_tag>;
|
Chris@16
|
51
|
Chris@16
|
52 template <>
|
Chris@16
|
53 struct is_sequence_impl<mpl_sequence_tag>;
|
Chris@16
|
54
|
Chris@16
|
55 template <>
|
Chris@16
|
56 struct is_sequence_impl<std_pair_tag>;
|
Chris@16
|
57 }
|
Chris@16
|
58
|
Chris@16
|
59 namespace traits
|
Chris@16
|
60 {
|
Chris@16
|
61 template <typename T>
|
Chris@16
|
62 struct is_sequence
|
Chris@16
|
63 : mpl::bool_<
|
Chris@16
|
64 (bool)extension::is_sequence_impl<
|
Chris@101
|
65 typename fusion::detail::tag_of<T>::type
|
Chris@16
|
66 >::template apply<T>::type::value
|
Chris@16
|
67 >
|
Chris@16
|
68 {};
|
Chris@16
|
69
|
Chris@16
|
70 template <typename Sequence, typename Enable = void>
|
Chris@16
|
71 struct is_native_fusion_sequence
|
Chris@101
|
72 : is_convertible<Sequence, fusion::detail::from_sequence_convertible_type>
|
Chris@16
|
73 {};
|
Chris@16
|
74 }
|
Chris@16
|
75 }}
|
Chris@16
|
76
|
Chris@16
|
77 #endif
|