at_impl.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*=============================================================================
  2. Copyright (c) 2009 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_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
  7. #define BOOST_FUSION_VIEW_REVERSE_VIEW_DETAIL_AT_IMPL_HPP
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/sequence/intrinsic/at.hpp>
  10. #include <boost/mpl/minus.hpp>
  11. #include <boost/mpl/int.hpp>
  12. namespace boost { namespace fusion { namespace extension
  13. {
  14. template <typename>
  15. struct at_impl;
  16. template <>
  17. struct at_impl<reverse_view_tag>
  18. {
  19. template <typename Seq, typename N>
  20. struct apply
  21. {
  22. typedef mpl::minus<typename Seq::size, mpl::int_<1>, N> real_n;
  23. typedef typename
  24. result_of::at<typename Seq::seq_type, real_n>::type
  25. type;
  26. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  27. static type
  28. call(Seq& seq)
  29. {
  30. return fusion::at<real_n>(seq.seq);
  31. }
  32. };
  33. };
  34. }}}
  35. #endif