value_at_impl.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  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(FUSION_VALUE_AT_IMPL_07172005_0952)
  7. #define FUSION_VALUE_AT_IMPL_07172005_0952
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/support/detail/access.hpp>
  10. #include <boost/type_traits/is_const.hpp>
  11. #include <boost/mpl/eval_if.hpp>
  12. #include <boost/mpl/bool.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. struct cons_tag;
  16. namespace extension
  17. {
  18. template <typename Tag>
  19. struct value_at_impl;
  20. template <>
  21. struct value_at_impl<cons_tag>
  22. {
  23. template <typename Sequence, typename N>
  24. struct apply
  25. {
  26. typedef typename
  27. mpl::eval_if<
  28. mpl::bool_<N::value == 0>
  29. , mpl::identity<typename Sequence::car_type>
  30. , apply<typename Sequence::cdr_type, mpl::int_<N::value-1> >
  31. >::type
  32. type;
  33. };
  34. };
  35. }
  36. }}
  37. #endif