value_at_impl.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*=============================================================================
  2. Copyright (c) 2014,2018 Kohei Takahashi
  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 FUSION_VALUE_AT_IMPL_16122014_1641
  7. #define FUSION_VALUE_AT_IMPL_16122014_1641
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/container/vector/detail/config.hpp>
  10. ///////////////////////////////////////////////////////////////////////////////
  11. // Without variadics, we will use the PP version
  12. ///////////////////////////////////////////////////////////////////////////////
  13. #if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
  14. # include <boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp>
  15. #else
  16. ///////////////////////////////////////////////////////////////////////////////
  17. // C++11 interface
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #include <boost/fusion/container/vector/vector_fwd.hpp>
  20. #include <boost/type_traits/declval.hpp>
  21. #include <boost/mpl/identity.hpp>
  22. namespace boost { namespace fusion
  23. {
  24. struct vector_tag;
  25. namespace vector_detail
  26. {
  27. template <std::size_t I, typename T>
  28. struct store;
  29. template <std::size_t N, typename U>
  30. static inline BOOST_FUSION_GPU_ENABLED
  31. mpl::identity<U> value_at_impl(store<N, U> const volatile*);
  32. }
  33. namespace extension
  34. {
  35. template <typename Tag>
  36. struct value_at_impl;
  37. template <>
  38. struct value_at_impl<vector_tag>
  39. {
  40. template <typename Sequence, typename N>
  41. struct apply : BOOST_FUSION_DECLTYPE_N3031((
  42. vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>())
  43. ))
  44. {};
  45. };
  46. }
  47. }}
  48. #endif
  49. #endif