at_impl.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(BOOST_FUSION_AT_IMPL_27122005_1241)
  8. #define BOOST_FUSION_AT_IMPL_27122005_1241
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/type_traits/is_const.hpp>
  11. #include <boost/mpl/if.hpp>
  12. namespace boost { namespace fusion {
  13. struct boost_array_tag;
  14. namespace extension
  15. {
  16. template<typename T>
  17. struct at_impl;
  18. template<>
  19. struct at_impl<boost_array_tag>
  20. {
  21. template<typename Sequence, typename N>
  22. struct apply
  23. {
  24. typedef typename mpl::if_<
  25. is_const<Sequence>,
  26. typename Sequence::const_reference,
  27. typename Sequence::reference>::type type;
  28. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  29. static type
  30. call(Sequence& seq)
  31. {
  32. return seq[N::value];
  33. }
  34. };
  35. };
  36. }
  37. }}
  38. #endif