next_impl.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_NEXT_IMPL_07162005_1029)
  7. #define FUSION_NEXT_IMPL_07162005_1029
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/iterator/next.hpp>
  10. namespace boost { namespace fusion
  11. {
  12. struct transform_view_iterator_tag;
  13. struct transform_view_iterator2_tag;
  14. template<typename First, typename F>
  15. struct transform_view_iterator;
  16. template <typename First1, typename First2, typename F>
  17. struct transform_view_iterator2;
  18. namespace extension
  19. {
  20. template <typename Tag>
  21. struct next_impl;
  22. // Unary Version
  23. template <>
  24. struct next_impl<transform_view_iterator_tag>
  25. {
  26. template <typename Iterator>
  27. struct apply
  28. {
  29. typedef typename Iterator::first_type first_type;
  30. typedef typename result_of::next<first_type>::type next_type;
  31. typedef typename Iterator::transform_type transform_type;
  32. typedef transform_view_iterator<next_type, transform_type> type;
  33. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  34. static type
  35. call(Iterator const& i)
  36. {
  37. return type(fusion::next(i.first), i.f);
  38. }
  39. };
  40. };
  41. // Binary Version
  42. template <>
  43. struct next_impl<transform_view_iterator2_tag>
  44. {
  45. template <typename Iterator>
  46. struct apply
  47. {
  48. typedef typename Iterator::first1_type first1_type;
  49. typedef typename Iterator::first2_type first2_type;
  50. typedef typename result_of::next<first1_type>::type next1_type;
  51. typedef typename result_of::next<first2_type>::type next2_type;
  52. typedef typename Iterator::transform_type transform_type;
  53. typedef transform_view_iterator2<next1_type, next2_type, transform_type> type;
  54. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  55. static type
  56. call(Iterator const& i)
  57. {
  58. return type(fusion::next(i.first1), fusion::next(i.first2), i.f);
  59. }
  60. };
  61. };
  62. }
  63. }}
  64. #endif