mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add enable_make_indexes
This commit is contained in:
parent
bc2e3e245b
commit
410c369a6a
100 changed files with 237 additions and 156 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple/integer_seq.hpp>
|
||||
#include <sprout/index_tuple/index_tuple.hpp>
|
||||
#include <sprout/utility/pack.hpp>
|
||||
|
||||
namespace std {
|
||||
#if defined(__clang__)
|
||||
|
@ -27,7 +28,7 @@ namespace std {
|
|||
struct tuple_element<I, sprout::integer_seq<T, Is...> > {
|
||||
static_assert(I < sizeof...(Is), "tuple_element<>: index out of range");
|
||||
public:
|
||||
typedef T type;
|
||||
typedef typename sprout::tppack_c_at<I, T, Is...>::type type;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -64,4 +65,39 @@ namespace std {
|
|||
#endif
|
||||
} // namespace std
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// tuple_get
|
||||
//
|
||||
template<std::size_t I, typename T, T... Is>
|
||||
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::integer_seq<T, Is...> >::type
|
||||
tuple_get(sprout::integer_seq<T, Is...>) SPROUT_NOEXCEPT {
|
||||
static_assert(I < sizeof...(Is), "tuple_get: index out of range");
|
||||
typedef typename std::tuple_element<I, sprout::integer_seq<T, Is...> >::type type;
|
||||
return type();
|
||||
}
|
||||
|
||||
//
|
||||
// tuple_get
|
||||
//
|
||||
template<std::size_t I, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::index_tuple<Indexes...> >::type
|
||||
tuple_get(sprout::index_tuple<Indexes...>) SPROUT_NOEXCEPT {
|
||||
static_assert(I < sizeof...(Indexes), "tuple_get: index out of range");
|
||||
typedef typename std::tuple_element<I, sprout::index_tuple<Indexes...> >::type type;
|
||||
return type();
|
||||
}
|
||||
|
||||
//
|
||||
// tuple_get
|
||||
//
|
||||
template<std::size_t I, sprout::uindex_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::uindex_tuple<Indexes...> >::type
|
||||
tuple_get(sprout::uindex_tuple<Indexes...>) SPROUT_NOEXCEPT {
|
||||
static_assert(I < sizeof...(Indexes), "tuple_get: index out of range");
|
||||
typedef typename std::tuple_element<I, sprout::uindex_tuple<Indexes...> >::type type;
|
||||
return type();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_INDEX_TUPLE_TUPLE_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue