at_impl.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_AT_IMPL_SEP_24_2009_0225PM)
  7. #define BOOST_FUSION_NVIEW_AT_IMPL_SEP_24_2009_0225PM
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/sequence/intrinsic/at.hpp>
  10. #include <boost/fusion/sequence/intrinsic/value_at.hpp>
  11. namespace boost { namespace fusion
  12. {
  13. struct nview_tag;
  14. namespace extension
  15. {
  16. template<typename Tag>
  17. struct at_impl;
  18. template<>
  19. struct at_impl<nview_tag>
  20. {
  21. template<typename Sequence, typename N>
  22. struct apply
  23. {
  24. typedef typename Sequence::sequence_type sequence_type;
  25. typedef typename Sequence::index_type index_type;
  26. typedef typename result_of::value_at<index_type, N>::type index;
  27. typedef typename result_of::at<sequence_type, index>::type type;
  28. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. static type
  30. call(Sequence& seq)
  31. {
  32. return fusion::at<index>(seq.seq);
  33. }
  34. };
  35. };
  36. }
  37. }}
  38. #endif