iterator_range.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_ITERATOR_RANGE_05062005_1224)
  7. #define FUSION_ITERATOR_RANGE_05062005_1224
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/detail/access.hpp>
  10. #include <boost/fusion/support/sequence_base.hpp>
  11. #include <boost/fusion/support/category_of.hpp>
  12. #include <boost/fusion/iterator/distance.hpp>
  13. #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
  14. #include <boost/fusion/view/iterator_range/detail/begin_impl.hpp>
  15. #include <boost/fusion/view/iterator_range/detail/end_impl.hpp>
  16. #include <boost/fusion/view/iterator_range/detail/at_impl.hpp>
  17. #include <boost/fusion/view/iterator_range/detail/size_impl.hpp>
  18. #include <boost/fusion/view/iterator_range/detail/value_at_impl.hpp>
  19. #include <boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp>
  20. #include <boost/fusion/view/iterator_range/detail/segments_impl.hpp>
  21. #include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
  22. #include <boost/config.hpp>
  23. #if defined (BOOST_MSVC)
  24. # pragma warning(push)
  25. # pragma warning (disable: 4512) // assignment operator could not be generated.
  26. #endif
  27. namespace boost { namespace fusion
  28. {
  29. struct iterator_range_tag;
  30. struct fusion_sequence_tag;
  31. template <typename First, typename Last>
  32. struct iterator_range : sequence_base<iterator_range<First, Last> >
  33. {
  34. typedef typename convert_iterator<First>::type begin_type;
  35. typedef typename convert_iterator<Last>::type end_type;
  36. typedef iterator_range_tag fusion_tag;
  37. typedef fusion_sequence_tag tag; // this gets picked up by MPL
  38. typedef mpl::true_ is_view;
  39. typedef typename traits::category_of<begin_type>::type category;
  40. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  41. iterator_range(First const& in_first, Last const& in_last)
  42. : first(convert_iterator<First>::call(in_first))
  43. , last(convert_iterator<Last>::call(in_last)) {}
  44. begin_type first;
  45. end_type last;
  46. };
  47. }}
  48. #if defined (BOOST_MSVC)
  49. # pragma warning(pop)
  50. #endif
  51. #endif