is_view.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 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_VIEW_03202006_0015)
  7. #define FUSION_IS_VIEW_03202006_0015
  8. #include <boost/mpl/bool.hpp>
  9. #include <boost/fusion/support/detail/is_view.hpp>
  10. #include <boost/fusion/support/tag_of.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. // Special tags:
  14. struct sequence_facade_tag;
  15. struct boost_tuple_tag; // boost::tuples::tuple tag
  16. struct boost_array_tag; // boost::array tag
  17. struct mpl_sequence_tag; // mpl sequence tag
  18. struct std_pair_tag; // std::pair tag
  19. namespace extension
  20. {
  21. template<typename Tag>
  22. struct is_view_impl
  23. {
  24. template <typename T>
  25. struct apply
  26. : detail::fusion_is_view<T>
  27. {};
  28. };
  29. template <>
  30. struct is_view_impl<sequence_facade_tag>
  31. {
  32. template <typename Sequence>
  33. struct apply : Sequence::is_view {};
  34. };
  35. template <>
  36. struct is_view_impl<boost_tuple_tag>;
  37. template <>
  38. struct is_view_impl<boost_array_tag>;
  39. template <>
  40. struct is_view_impl<mpl_sequence_tag>;
  41. template <>
  42. struct is_view_impl<std_pair_tag>;
  43. }
  44. namespace traits
  45. {
  46. template <typename T>
  47. struct is_view :
  48. mpl::bool_<
  49. (bool)extension::is_view_impl<typename fusion::detail::tag_of<T>::type>::
  50. template apply<T>::type::value
  51. >
  52. {};
  53. }
  54. }}
  55. #endif