joint_view_iterator.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_JOINT_VIEW_ITERATOR_07162005_0140)
  7. #define FUSION_JOINT_VIEW_ITERATOR_07162005_0140
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/iterator_base.hpp>
  10. #include <boost/fusion/iterator/equal_to.hpp>
  11. #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
  12. #include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
  13. #include <boost/fusion/view/joint_view/detail/deref_impl.hpp>
  14. #include <boost/fusion/view/joint_view/detail/next_impl.hpp>
  15. #include <boost/fusion/view/joint_view/detail/value_of_impl.hpp>
  16. #include <boost/fusion/view/joint_view/detail/deref_data_impl.hpp>
  17. #include <boost/fusion/view/joint_view/detail/value_of_data_impl.hpp>
  18. #include <boost/fusion/view/joint_view/detail/key_of_impl.hpp>
  19. #include <boost/static_assert.hpp>
  20. namespace boost { namespace fusion
  21. {
  22. struct joint_view_iterator_tag;
  23. struct forward_traversal_tag;
  24. template <typename Category, typename First, typename Last, typename Concat>
  25. struct joint_view_iterator
  26. : iterator_base<joint_view_iterator<Category, First, Last, Concat> >
  27. {
  28. typedef convert_iterator<First> first_converter;
  29. typedef convert_iterator<Last> last_converter;
  30. typedef convert_iterator<Concat> concat_converter;
  31. typedef typename first_converter::type first_type;
  32. typedef typename last_converter::type last_type;
  33. typedef typename concat_converter::type concat_type;
  34. typedef joint_view_iterator_tag fusion_tag;
  35. typedef Category category;
  36. BOOST_STATIC_ASSERT((!result_of::equal_to<first_type, last_type>::value));
  37. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  38. joint_view_iterator(First const& in_first, Concat const& in_concat)
  39. : first(first_converter::call(in_first))
  40. , concat(concat_converter::call(in_concat))
  41. {}
  42. first_type first;
  43. concat_type concat;
  44. private:
  45. // silence MSVC warning C4512: assignment operator could not be generated
  46. joint_view_iterator& operator= (joint_view_iterator const&);
  47. };
  48. }}
  49. #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
  50. namespace std
  51. {
  52. template <typename Category, typename First, typename Last, typename Concat>
  53. struct iterator_traits< ::boost::fusion::joint_view_iterator<Category, First, Last, Concat> >
  54. { };
  55. }
  56. #endif
  57. #endif