single_view_iterator.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2011 Eric Niebler
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(BOOST_FUSION_SINGLE_VIEW_ITERATOR_05052005_0340)
  8. #define BOOST_FUSION_SINGLE_VIEW_ITERATOR_05052005_0340
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/support/detail/access.hpp>
  11. #include <boost/fusion/support/iterator_base.hpp>
  12. #include <boost/fusion/view/single_view/detail/deref_impl.hpp>
  13. #include <boost/fusion/view/single_view/detail/next_impl.hpp>
  14. #include <boost/fusion/view/single_view/detail/prior_impl.hpp>
  15. #include <boost/fusion/view/single_view/detail/advance_impl.hpp>
  16. #include <boost/fusion/view/single_view/detail/distance_impl.hpp>
  17. #include <boost/fusion/view/single_view/detail/equal_to_impl.hpp>
  18. #include <boost/fusion/view/single_view/detail/value_of_impl.hpp>
  19. #include <boost/config.hpp>
  20. #if defined (BOOST_MSVC)
  21. # pragma warning(push)
  22. # pragma warning (disable: 4512) // assignment operator could not be generated.
  23. #endif
  24. namespace boost { namespace fusion
  25. {
  26. struct single_view_iterator_tag;
  27. struct random_access_traversal_tag;
  28. template <typename SingleView, typename Pos>
  29. struct single_view_iterator
  30. : iterator_base<single_view_iterator<SingleView, Pos> >
  31. {
  32. typedef single_view_iterator_tag fusion_tag;
  33. typedef random_access_traversal_tag category;
  34. typedef typename SingleView::value_type value_type;
  35. typedef Pos position;
  36. typedef SingleView single_view_type;
  37. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  38. explicit single_view_iterator(single_view_type& in_view)
  39. : view(in_view) {}
  40. SingleView& view;
  41. private:
  42. single_view_iterator& operator=(single_view_iterator const&);
  43. };
  44. }}
  45. #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
  46. namespace std
  47. {
  48. template <typename SingleView, typename Pos>
  49. struct iterator_traits< ::boost::fusion::single_view_iterator<SingleView, Pos> >
  50. { };
  51. }
  52. #endif
  53. #if defined (BOOST_MSVC)
  54. # pragma warning(pop)
  55. #endif
  56. #endif