1 /*============================================================================= 2 Copyright (c) 2001-2011 Joel de Guzman 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_SEQUENCE_05052005_1002) 8 #define FUSION_IS_SEQUENCE_05052005_1002 9 10 #include <boost/fusion/support/config.hpp> 11 #include <boost/fusion/support/sequence_base.hpp> 12 #include <boost/fusion/support/tag_of.hpp> 13 #include <boost/fusion/support/detail/is_native_fusion_sequence.hpp> 14 #include <boost/mpl/bool.hpp> 15 #include <boost/mpl/is_sequence.hpp> 16 #include <boost/type_traits/is_convertible.hpp> 17 18 namespace boost { namespace fusion 19 { 20 // Special tags: 21 struct non_fusion_tag; 22 struct boost_tuple_tag; // boost::tuples::tuple tag 23 struct boost_array_tag; // boost::array tag 24 struct mpl_sequence_tag; // mpl sequence tag 25 struct std_pair_tag; // std::pair tag 26 27 namespace extension 28 { 29 template <typename T> 30 struct is_sequence_impl 31 { 32 template <typename Sequence> 33 struct apply 34 : is_convertible<Sequence, fusion::detail::from_sequence_convertible_type> 35 {}; 36 }; 37 38 template <> 39 struct is_sequence_impl<non_fusion_tag> 40 { 41 template <typename T> 42 struct apply : mpl::false_ {}; 43 }; 44 45 template <> 46 struct is_sequence_impl<boost_tuple_tag>; 47 48 template <> 49 struct is_sequence_impl<boost_array_tag>; 50 51 template <> 52 struct is_sequence_impl<mpl_sequence_tag>; 53 54 template <> 55 struct is_sequence_impl<std_pair_tag>; 56 } 57 58 namespace traits 59 { 60 template <typename T> 61 struct is_sequence 62 : mpl::bool_< 63 (bool)extension::is_sequence_impl< 64 typename fusion::detail::tag_of<T>::type 65 >::template apply<T>::type::value 66 > 67 {}; 68 69 using detail::is_native_fusion_sequence; 70 } 71 }} 72 73 #endif 74