is_segmented.hpp 1.5 KB

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