diff --git a/src/openrct2/core/Meta.hpp b/src/openrct2/core/Meta.hpp index 2293e8ae88..b63d140f17 100644 --- a/src/openrct2/core/Meta.hpp +++ b/src/openrct2/core/Meta.hpp @@ -16,15 +16,15 @@ namespace Meta /** * Meta function for checking that all Conditions are true types. */ - template struct all : std::true_type + template struct all : std::true_type { }; - template - struct all : std::conditional, std::false_type>::type + template + struct all<_TCondition, _TConditions...> : std::conditional<_TCondition::value, all<_TConditions...>, std::false_type>::type { }; - template using all_convertible = all...>; + template using all_convertible = all...>; } // namespace Meta diff --git a/src/openrct2/core/Random.hpp b/src/openrct2/core/Random.hpp index daab3291cf..cdca9daa73 100644 --- a/src/openrct2/core/Random.hpp +++ b/src/openrct2/core/Random.hpp @@ -27,12 +27,12 @@ namespace Random /** * FixedSeedSequence adheres to the _Named Requirement_ `SeedSequence`. */ - template class FixedSeedSequence + template class FixedSeedSequence { public: using result_type = uint32_t; - static constexpr size_t N = _num; + static constexpr size_t N = _TNum; static constexpr result_type default_seed = 0x1234567F; explicit FixedSeedSequence() @@ -41,26 +41,26 @@ namespace Random } template< - typename... T, typename std::enable_if::type = 0, - typename std::enable_if::value, int>::type = 0> - explicit FixedSeedSequence(T... s) + typename... _TTypes, typename std::enable_if::type = 0, + typename std::enable_if::value, int>::type = 0> + explicit FixedSeedSequence(_TTypes... s) : v{ static_cast(s)... } { } - template(), ++std::declval<_It&>(), void())> - explicit FixedSeedSequence(_It begin, _It end) + template(), ++std::declval<_TIt&>(), void())> + explicit FixedSeedSequence(_TIt begin, _TIt end) { std::copy(begin, end, v.begin()); } - template - explicit FixedSeedSequence(std::initializer_list il) + template + explicit FixedSeedSequence(std::initializer_list<_TType> il) : FixedSeedSequence(il.begin(), il.end()) { } - template void generate(_It begin, _It end) const + template void generate(_TIt begin, _TIt end) const { std::copy_n(v.begin(), std::min((size_t)(end - begin), N), begin); } @@ -70,7 +70,7 @@ namespace Random return N; } - template constexpr void param(_It ob) const + template constexpr void param(_TIt ob) const { std::copy(v.begin(), v.end(), ob); } @@ -79,9 +79,9 @@ namespace Random std::array v; }; - template struct RotateEngineState + template struct RotateEngineState { - using value_type = UIntType; + using value_type = _TUIntType; value_type s0; value_type s1; @@ -91,20 +91,21 @@ namespace Random * RotateEngine adheres to the _Named Requirement_ `RandomNumberEngine` * https://en.cppreference.com/w/cpp/named_req/RandomNumberEngine */ - template class RotateEngine : protected RotateEngineState + template + class RotateEngine : protected RotateEngineState<_TUIntType> { - static_assert(std::is_unsigned::value, "Type must be unsigned integral."); + static_assert(std::is_unsigned<_TUIntType>::value, "Type must be unsigned integral."); - using RotateEngineState::s0; - using RotateEngineState::s1; + using RotateEngineState<_TUIntType>::s0; + using RotateEngineState<_TUIntType>::s1; public: - using result_type = UIntType; - using state_type = RotateEngineState; + using result_type = _TUIntType; + using state_type = RotateEngineState<_TUIntType>; - static constexpr result_type x = _x; - static constexpr size_t r1 = _r1; - static constexpr size_t r2 = _r2; + static constexpr result_type x = _TX; + static constexpr size_t r1 = _TR1; + static constexpr size_t r2 = _TR2; static constexpr result_type default_seed = 1; static constexpr result_type min() @@ -128,8 +129,8 @@ namespace Random s1 = r.s1; } - template::value>::type> - explicit RotateEngine(Sseq& seed_seq) + template::value>::type> + explicit RotateEngine(_TSseq& seed_seq) { seed(seed_seq); } @@ -140,7 +141,7 @@ namespace Random s1 = s; } - template typename std::enable_if::value, void>::type seed(Sseq& seed_seq) + template typename std::enable_if::value, void>::type seed(_TSseq& seed_seq) { std::array s; seed_seq.generate(s.begin(), s.end());