at_impl.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_STD_ARRAY_AT_IMPL_01062013_1700)
  8. #define BOOST_FUSION_STD_ARRAY_AT_IMPL_01062013_1700
  9. #include <boost/type_traits/is_const.hpp>
  10. #include <boost/mpl/if.hpp>
  11. namespace boost { namespace fusion {
  12. struct std_array_tag;
  13. namespace extension
  14. {
  15. template<typename T>
  16. struct at_impl;
  17. template<>
  18. struct at_impl<std_array_tag>
  19. {
  20. template<typename Sequence, typename N>
  21. struct apply
  22. {
  23. typedef typename mpl::if_<
  24. is_const<Sequence>,
  25. typename Sequence::const_reference,
  26. typename Sequence::reference>::type type;
  27. static type
  28. call(Sequence& seq)
  29. {
  30. return seq[N::value];
  31. }
  32. };
  33. };
  34. }
  35. }}
  36. #endif