File indexing completed on 2025-12-15 09:53:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_TYPE_AT_HPP
0011 #define BOOST_HANA_DETAIL_TYPE_AT_HPP
0012
0013 #include <boost/hana/config.hpp>
0014
0015 #include <cstddef>
0016 #include <utility>
0017
0018
0019
0020 #if defined(__has_builtin)
0021 # if __has_builtin(__type_pack_element)
0022 # define BOOST_HANA_USE_TYPE_PACK_ELEMENT_INTRINSIC
0023 # endif
0024 #endif
0025
0026 namespace boost { namespace hana { namespace detail {
0027 namespace td {
0028 template <std::size_t I, typename T>
0029 struct elt { using type = T; };
0030
0031 template <typename Indices, typename ...T>
0032 struct indexer;
0033
0034 template <std::size_t ...I, typename ...T>
0035 struct indexer<std::index_sequence<I...>, T...>
0036 : elt<I, T>...
0037 { };
0038
0039 template <std::size_t I, typename T>
0040 elt<I, T> get_elt(elt<I, T> const&);
0041 }
0042
0043
0044
0045
0046 template <std::size_t n, typename ...T>
0047 struct type_at {
0048 #if defined(BOOST_HANA_USE_TYPE_PACK_ELEMENT_INTRINSIC)
0049 using type = __type_pack_element<n, T...>;
0050 #else
0051 using Indexer = td::indexer<std::make_index_sequence<sizeof...(T)>, T...>;
0052 using type = typename decltype(td::get_elt<n>(Indexer{}))::type;
0053 #endif
0054 };
0055 } }}
0056
0057 #endif