[+] AuTupleCountOf_v

This commit is contained in:
Reece Wilson 2022-03-28 12:08:59 +01:00
parent 5205cf1785
commit 681581486e

View File

@ -66,6 +66,9 @@ static auto AuTupleApply(F &&f, Tuple &&t)
return AURORA_RUNTIME_APPLY(f, t); return AURORA_RUNTIME_APPLY(f, t);
} }
template <class T>
inline constexpr AuUInt AuTupleCountOf_v = AURORA_RUNTIME_TUPLE_SIZE<AuRemoveConst_t<AuRemoveReference_t<T>>>::value;
namespace __audetail namespace __audetail
{ {
template <AuUInt Offset, class Tuple, AuUInt... Is> template <AuUInt Offset, class Tuple, AuUInt... Is>
@ -78,13 +81,13 @@ namespace __audetail
template <class... Ts> template <class... Ts>
static auto AuTuplePopFront(const AuTuple<Ts...> &tuple) static auto AuTuplePopFront(const AuTuple<Ts...> &tuple)
{ {
return __audetail::AuTuplePopImpl<1>(tuple, AuMakeIndexSequence<AURORA_RUNTIME_TUPLE_SIZE<tuple>::value - 1>()); return __audetail::AuTuplePopImpl<1>(tuple, AuMakeIndexSequence<AuTupleCountOf_v<decltype(tuple)> -1>());
} }
template <class... Ts> template <class... Ts>
static auto AuTuplePopBack(const AuTuple<Ts...> &tuple) static auto AuTuplePopBack(const AuTuple<Ts...> &tuple)
{ {
return __audetail::AuTuplePopImpl<0>(tuple, AuMakeIndexSequence<AURORA_RUNTIME_TUPLE_SIZE<tuple>::value - 1>()); return __audetail::AuTuplePopImpl<0>(tuple, AuMakeIndexSequence<AuTupleCountOf_v<decltype(tuple)> - 1>());
} }
template <class T, class... Ts> template <class T, class... Ts>