deref_impl.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*=============================================================================
  2. Copyright (c) 2010 Christopher Schmidt
  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. #ifndef BOOST_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
  7. #define BOOST_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/type_traits/add_reference.hpp>
  10. #include <boost/type_traits/remove_extent.hpp>
  11. namespace boost { namespace fusion { namespace extension
  12. {
  13. template <typename>
  14. struct deref_impl;
  15. template <>
  16. struct deref_impl<po_array_iterator_tag>
  17. {
  18. template <typename It>
  19. struct apply
  20. {
  21. typedef typename
  22. add_reference<
  23. typename remove_extent<typename It::seq_type>::type
  24. >::type
  25. type;
  26. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  27. static type
  28. call(It const& it)
  29. {
  30. return (*it.seq)[It::index::value];
  31. }
  32. };
  33. };
  34. }}}
  35. #endif