deref_impl.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_DEREF_IMPL_05052005_0258)
  8. #define BOOST_FUSION_SINGLE_VIEW_DEREF_IMPL_05052005_0258
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/mpl/int.hpp>
  11. #include <boost/mpl/assert.hpp>
  12. #include <boost/mpl/equal_to.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. struct single_view_iterator_tag;
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct deref_impl;
  20. template <>
  21. struct deref_impl<single_view_iterator_tag>
  22. {
  23. template <typename Iterator>
  24. struct apply
  25. {
  26. BOOST_MPL_ASSERT((mpl::equal_to<typename Iterator::position, mpl::int_<0> >));
  27. typedef typename Iterator::value_type type;
  28. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. static type
  30. call(Iterator const& i)
  31. {
  32. return i.view.val;
  33. }
  34. };
  35. };
  36. }
  37. }}
  38. #endif