next_impl.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_NEXT_IMPL_05052005_0331)
  8. #define BOOST_FUSION_SINGLE_VIEW_NEXT_IMPL_05052005_0331
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/mpl/next.hpp>
  11. #include <boost/static_assert.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. struct single_view_iterator_tag;
  15. template <typename SingleView, typename Pos>
  16. struct single_view_iterator;
  17. namespace extension
  18. {
  19. template <typename Tag>
  20. struct next_impl;
  21. template <>
  22. struct next_impl<single_view_iterator_tag>
  23. {
  24. template <typename Iterator>
  25. struct apply
  26. {
  27. typedef single_view_iterator<
  28. typename Iterator::single_view_type,
  29. typename mpl::next<typename Iterator::position>::type>
  30. type;
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. static type
  33. call(Iterator const& i)
  34. {
  35. // Workaround for ICE on GCC 4.0.0.
  36. // see https://svn.boost.org/trac/boost/ticket/5808
  37. typedef typename type::position position;
  38. BOOST_STATIC_ASSERT((position::value < 2));
  39. return type(i.view);
  40. }
  41. };
  42. };
  43. }
  44. }}
  45. #endif