reverse_view_iterator.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef _MSC_VER
  25. # pragma warning(push)
  26. # pragma warning(disable: 4512) // assignment operator could not be generated.
  27. #endif
  28. namespace boost { namespace fusion
  29. {
  30. struct reverse_view_iterator_tag;
  31. template <typename First>
  32. struct reverse_view_iterator
  33. : iterator_base<reverse_view_iterator<First> >
  34. {
  35. typedef convert_iterator<First> converter;
  36. typedef typename converter::type first_type;
  37. typedef reverse_view_iterator_tag fusion_tag;
  38. typedef typename traits::category_of<first_type>::type category;
  39. BOOST_STATIC_ASSERT((
  40. is_base_of<
  41. bidirectional_traversal_tag
  42. , category>::value));
  43. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  44. reverse_view_iterator(First const& in_first)
  45. : first(converter::call(in_first)) {}
  46. first_type first;
  47. };
  48. }}
  49. #ifdef _MSC_VER
  50. # pragma warning(pop)
  51. #endif
  52. #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
  53. namespace std
  54. {
  55. template <typename First>
  56. struct iterator_traits< ::boost::fusion::reverse_view_iterator<First> >
  57. { };
  58. }
  59. #endif
  60. #endif