at_impl.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*=============================================================================
  2. Copyright (c) 2011 Eric Niebler
  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_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM)
  7. #define BOOST_FUSION_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/mpl/int.hpp>
  10. #include <boost/mpl/assert.hpp>
  11. #include <boost/mpl/equal_to.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. struct single_view_tag;
  15. namespace extension
  16. {
  17. template<typename Tag>
  18. struct at_impl;
  19. template<>
  20. struct at_impl<single_view_tag>
  21. {
  22. template<typename Sequence, typename N>
  23. struct apply
  24. {
  25. BOOST_MPL_ASSERT((mpl::equal_to<N, mpl::int_<0> >));
  26. typedef typename Sequence::value_type type;
  27. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  28. static type
  29. call(Sequence& seq)
  30. {
  31. return seq.val;
  32. }
  33. };
  34. };
  35. }
  36. }}
  37. #endif