segments_impl.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*=============================================================================
  2. Copyright (c) 2011 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(BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED)
  7. #define BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/mpl/assert.hpp>
  10. #include <boost/fusion/sequence/intrinsic/segments.hpp>
  11. #include <boost/fusion/support/is_segmented.hpp>
  12. #include <boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. struct iterator_range_tag;
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct segments_impl;
  20. template <>
  21. struct segments_impl<iterator_range_tag>
  22. {
  23. template <typename Sequence>
  24. struct apply
  25. {
  26. typedef
  27. detail::make_segmented_range<
  28. typename Sequence::begin_type
  29. , typename Sequence::end_type
  30. >
  31. impl;
  32. BOOST_MPL_ASSERT((traits::is_segmented<typename impl::type>));
  33. typedef
  34. typename result_of::segments<typename impl::type>::type
  35. type;
  36. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  37. static type call(Sequence & seq)
  38. {
  39. return fusion::segments(impl::call(seq.first, seq.last));
  40. }
  41. };
  42. };
  43. }
  44. }}
  45. #endif