is_segmented.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/mpl/bool.hpp>
  9. #include <boost/fusion/support/tag_of.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. // Special tags:
  13. struct sequence_facade_tag;
  14. struct iterator_range_tag;
  15. namespace extension
  16. {
  17. template <typename Tag>
  18. struct is_segmented_impl
  19. {
  20. template <typename Sequence>
  21. struct apply
  22. : mpl::false_
  23. {};
  24. };
  25. template <>
  26. struct is_segmented_impl<sequence_facade_tag>
  27. {
  28. template <typename Sequence>
  29. struct apply : Sequence::is_segmented {};
  30. };
  31. template <>
  32. struct is_segmented_impl<iterator_range_tag>;
  33. }
  34. namespace traits
  35. {
  36. template <typename Sequence>
  37. struct is_segmented
  38. : mpl::bool_<
  39. (bool)extension::is_segmented_impl<typename traits::tag_of<Sequence>::type>::
  40. template apply<Sequence>::type::value
  41. >
  42. {
  43. };
  44. }
  45. }}
  46. #endif