diff --git a/Source/Core/Common/TypeUtils.h b/Source/Core/Common/TypeUtils.h index 47077e11fb..ce2fd516cd 100644 --- a/Source/Core/Common/TypeUtils.h +++ b/Source/Core/Common/TypeUtils.h @@ -83,4 +83,17 @@ static_assert(!IsNOf::value); static_assert(IsNOf::value); static_assert(IsNOf::value); // Type conversions ARE allowed static_assert(!IsNOf::value); + +// TODO: This can be replaced with std::array's fill() once C++20 is fully supported. +// Prior to C++20, std::array's fill() function is, unfortunately, not constexpr. +// Ditto for 's std::fill. Although Dolphin targets C++20, Android doesn't +// seem to properly support constexpr fill(), so we need this for now. +template +constexpr void Fill(std::array& array, const T2& value) +{ + for (auto& entry : array) + { + entry = value; + } +} } // namespace Common