reverse_view_iterator.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_REVERSE_VIEW_ITERATOR_07202005_0835)
  7. #define FUSION_REVERSE_VIEW_ITERATOR_07202005_0835
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/iterator_base.hpp>
  10. #include <boost/fusion/support/category_of.hpp>
  11. #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
  12. #include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
  13. #include <boost/fusion/view/reverse_view/detail/deref_impl.hpp>
  14. #include <boost/fusion/view/reverse_view/detail/next_impl.hpp>
  15. #include <boost/fusion/view/reverse_view/detail/prior_impl.hpp>
  16. #include <boost/fusion/view/reverse_view/detail/advance_impl.hpp>
  17. #include <boost/fusion/view/reverse_view/detail/distance_impl.hpp>
  18. #include <boost/fusion/view/reverse_view/detail/value_of_impl.hpp>
  19. #include <boost/fusion/view/reverse_view/detail/deref_data_impl.hpp>
  20. #include <boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp>
  21. #include <boost/fusion/view/reverse_view/detail/key_of_impl.hpp>
  22. #include <boost/type_traits/is_base_of.hpp>
  23. #include <boost/static_assert.hpp>
  24. namespace boost { namespace fusion
  25. {
  26. struct reverse_view_iterator_tag;
  27. template <typename First>
  28. struct reverse_view_iterator
  29. : iterator_base<reverse_view_iterator<First> >
  30. {
  31. typedef convert_iterator<First> converter;
  32. typedef typename converter::type first_type;
  33. typedef reverse_view_iterator_tag fusion_tag;
  34. typedef typename traits::category_of<first_type>::type category;
  35. BOOST_STATIC_ASSERT((
  36. is_base_of<
  37. bidirectional_traversal_tag
  38. , category>::value));
  39. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  40. reverse_view_iterator(First const& in_first)
  41. : first(converter::call(in_first)) {}
  42. first_type first;
  43. private:
  44. // silence MSVC warning C4512: assignment operator could not be generated
  45. reverse_view_iterator& operator= (reverse_view_iterator const&);
  46. };
  47. }}
  48. #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
  49. namespace std
  50. {
  51. template <typename First>
  52. struct iterator_traits< ::boost::fusion::reverse_view_iterator<First> >
  53. { };
  54. }
  55. #endif
  56. #endif