deref_impl.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2009 Hartmut Kaiser
  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(BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM)
  7. #define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/iterator/value_of.hpp>
  10. #include <boost/fusion/sequence/intrinsic/at.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. struct nview_iterator_tag;
  14. namespace extension
  15. {
  16. template<typename Tag>
  17. struct deref_impl;
  18. template<>
  19. struct deref_impl<nview_iterator_tag>
  20. {
  21. template<typename Iterator>
  22. struct apply
  23. {
  24. typedef typename Iterator::first_type first_type;
  25. typedef typename Iterator::sequence_type sequence_type;
  26. typedef typename result_of::value_of<first_type>::type index;
  27. typedef typename result_of::at<
  28. typename sequence_type::sequence_type, index>::type type;
  29. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  30. static type call(Iterator const& i)
  31. {
  32. return at<index>(i.seq.seq);
  33. }
  34. };
  35. };
  36. }
  37. }}
  38. #endif