AuroraRuntime/Include/auROXTL/auIntegerSequence.hpp

35 lines
825 B
C++
Raw Normal View History

2022-03-25 12:00:44 +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
2022-03-25 21:32:36 +00:00
template <class T, T... Args>
2022-03-25 12:00:44 +00:00
struct AuIntegerSequence
{
using value_type = T;
inline constexpr AuUInt size()
{
return sizeof...(Args);
}
};
2022-03-25 21:32:36 +00:00
template <class T, T Num>
2022-03-25 12:00:44 +00:00
#if defined(AURORA_COMPILER_GCC)
using AuMakeIntegerSequence = std::make_integer_sequence<T, Num>;
#else
using AuMakeIntegerSequence = __make_integer_seq<AuIntegerSequence, T, Num>;
#endif
2022-03-25 21:32:36 +00:00
template <AuUInt Num>
2022-03-25 12:00:44 +00:00
using AuMakeIndexSequence = AuMakeIntegerSequence<AuUInt, Num>;
2022-03-25 21:32:36 +00:00
template <AuUInt... Args>
2022-03-25 12:00:44 +00:00
using AuIndexSequence = AuIntegerSequence<AuUInt, Args...>;
2022-03-25 21:32:36 +00:00
template <class... Args>
2022-03-25 12:00:44 +00:00
using AuIndexSequenceFor = AuMakeIndexSequence<sizeof...(Args)>;