/Src/Dependencies/Boost/boost/fusion/support/is_sequence.hpp

http://hadesmem.googlecode.com/ · C++ Header · 74 lines · 56 code · 11 blank · 7 comment · 0 complexity · dc1859eac5658e95645a10ef20617f50 MD5 · raw file

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