AuROXTL/Include/auROXTL/auIntegerSequence.hpp

35 lines
825 B
C++
Raw Permalink Normal View History

2022-04-01 04:06:53 +00:00
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: auIntegerSequence.hpp
Date: 2022-3-25
Author: Reece
***/
#pragma once
template <class T, T... Args>
struct AuIntegerSequence
{
using value_type = T;
inline constexpr AuUInt size()
{
return sizeof...(Args);
}
};
template <class T, T Num>
#if defined(AURORA_COMPILER_GCC)
using AuMakeIntegerSequence = std::make_integer_sequence<T, Num>;
#else
using AuMakeIntegerSequence = __make_integer_seq<AuIntegerSequence, T, Num>;
#endif
template <AuUInt Num>
using AuMakeIndexSequence = AuMakeIntegerSequence<AuUInt, Num>;
template <AuUInt... Args>
using AuIndexSequence = AuIntegerSequence<AuUInt, Args...>;
template <class... Args>
using AuIndexSequenceFor = AuMakeIndexSequence<sizeof...(Args)>;