mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Common/DimensionalArray: Don't break clang
This commit is contained in:
parent
532c2a0c15
commit
46dfccef81
|
@ -29,6 +29,9 @@ namespace detail {
|
||||||
template<typename T, std::size_t rank, std::size_t... sizes>
|
template<typename T, std::size_t rank, std::size_t... sizes>
|
||||||
struct DimensionalArrayExplicitRank;
|
struct DimensionalArrayExplicitRank;
|
||||||
|
|
||||||
|
// Workaround for VC2017
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1920
|
||||||
|
|
||||||
template<std::size_t rank, std::size_t... sizes>
|
template<std::size_t rank, std::size_t... sizes>
|
||||||
struct GetRankSize
|
struct GetRankSize
|
||||||
{
|
{
|
||||||
|
@ -41,6 +44,22 @@ using GetArrayImplType =
|
||||||
std::array<std::conditional_t<rank == 1, T, DimensionalArrayExplicitRank<T, rank - 1, sizes...>>,
|
std::array<std::conditional_t<rank == 1, T, DimensionalArrayExplicitRank<T, rank - 1, sizes...>>,
|
||||||
GetRankSize<rank, sizes...>::value>;
|
GetRankSize<rank, sizes...>::value>;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
template<std::size_t rank, std::size_t... sizes>
|
||||||
|
constexpr std::size_t GetRankSize()
|
||||||
|
{
|
||||||
|
constexpr std::size_t size_array[] = {sizes...};
|
||||||
|
return size_array[rank - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T, std::size_t rank, std::size_t... sizes>
|
||||||
|
using GetArrayImplType =
|
||||||
|
std::array<std::conditional_t<rank == 1, T, DimensionalArrayExplicitRank<T, rank - 1, sizes...>>,
|
||||||
|
GetRankSize<rank, sizes...>()>;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T, std::size_t rank_param, std::size_t... sizes>
|
template<typename T, std::size_t rank_param, std::size_t... sizes>
|
||||||
struct DimensionalArrayExplicitRank : public GetArrayImplType<T, rank_param, sizes...>
|
struct DimensionalArrayExplicitRank : public GetArrayImplType<T, rank_param, sizes...>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue