From 6839736b8283a59eb743e1f6058c7d266a3e7f36 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Tue, 28 Jun 2022 12:17:48 -0700 Subject: Changeset: 78 Replace "class" keyword in templates with "typename" --- source/10-common/Enum.hpp | 4 ++-- source/10-common/PodVector.hpp | 2 +- source/10-common/RTTI.hpp | 10 +++++----- source/10-common/RapidJsonHelper.hpp | 4 ++-- source/10-common/RcPtr.hpp | 6 +++--- source/10-common/Rect.hpp | 4 ++-- source/10-common/ScopeGuard.hpp | 4 ++-- source/10-common/SmallVector.cpp | 6 +++--- source/10-common/SmallVector.hpp | 10 +++++----- source/10-common/Type2ObjectMap.hpp | 2 +- source/10-common/Utils.hpp | 2 +- source/10-common/YCombinator.hpp | 4 ++-- 12 files changed, 29 insertions(+), 29 deletions(-) (limited to 'source/10-common') diff --git a/source/10-common/Enum.hpp b/source/10-common/Enum.hpp index 5d75955..7afbe8e 100644 --- a/source/10-common/Enum.hpp +++ b/source/10-common/Enum.hpp @@ -3,7 +3,7 @@ #include #include -template +template class EnumFlags { public: using Enum = TEnum; @@ -103,7 +103,7 @@ public: }; // Helper class for enumerating enum elements for ImGui::Begin/EndCombo -template +template struct EnumElement { const char* name; TEnum value; diff --git a/source/10-common/PodVector.hpp b/source/10-common/PodVector.hpp index 74e99d6..bd92e7d 100644 --- a/source/10-common/PodVector.hpp +++ b/source/10-common/PodVector.hpp @@ -8,7 +8,7 @@ #include #include -template +template class PodVector { public: using value_type = T; diff --git a/source/10-common/RTTI.hpp b/source/10-common/RTTI.hpp index bc0d289..bd9475b 100644 --- a/source/10-common/RTTI.hpp +++ b/source/10-common/RTTI.hpp @@ -2,13 +2,13 @@ #include -template +template bool is_a(TBase* t) { assert(t != nullptr); return T::IsInstance(t); } -template +template bool is_a_nullable(TBase* t) { if (t) { return is_a(t); @@ -17,7 +17,7 @@ bool is_a_nullable(TBase* t) { } } -template +template T* dyn_cast(TBase* t) { assert(t != nullptr); if (T::IsInstance(t)) { @@ -27,7 +27,7 @@ T* dyn_cast(TBase* t) { } } -template +template const T* dyn_cast(const TBase* t) { assert(t != nullptr); if (T::IsInstance(t)) { @@ -37,7 +37,7 @@ const T* dyn_cast(const TBase* t) { } } -template +template T* dyn_cast_nullable(TBase* t) { if (!t) return nullptr; return dyn_cast(t); diff --git a/source/10-common/RapidJsonHelper.hpp b/source/10-common/RapidJsonHelper.hpp index 75cd93a..008c6bb 100644 --- a/source/10-common/RapidJsonHelper.hpp +++ b/source/10-common/RapidJsonHelper.hpp @@ -75,7 +75,7 @@ inline GenericStringRef StringRef(std::string_view str) { str.size()); } -template +template rapidjson::Value WriteVectorPrimitives(rapidjson::Document& root, TIter begin, TSentienl end) { using TElement = typename TIter::value_type; @@ -92,7 +92,7 @@ rapidjson::Value WriteVectorPrimitives(rapidjson::Document& root, TIter begin, T return list; } -template +template bool ReadVectorPrimitives(const rapidjson::Value& value, TContainer& list) { using TElement = typename TContainer::value_type; diff --git a/source/10-common/RcPtr.hpp b/source/10-common/RcPtr.hpp index 130b2b2..e3e420e 100644 --- a/source/10-common/RcPtr.hpp +++ b/source/10-common/RcPtr.hpp @@ -15,7 +15,7 @@ public: uint32_t weakCount = 0; // TODO implement }; -template > +template > class RcPtr : TDeleter { private: static_assert(std::is_base_of_v); @@ -78,7 +78,7 @@ public: return *this; } - template + template requires std::is_base_of_v operator RcPtr() const { return RcPtr(mPtr); @@ -96,7 +96,7 @@ public: return mPtr == ptr; } - template + template bool operator==(const RcPtr& ptr) const { return mPtr == ptr.Get(); } diff --git a/source/10-common/Rect.hpp b/source/10-common/Rect.hpp index 89d9b01..86a1268 100644 --- a/source/10-common/Rect.hpp +++ b/source/10-common/Rect.hpp @@ -4,7 +4,7 @@ /// Rect is a rectangle representation based on a point and a dimensions, in television coordinate space /// (x increases from left to right, y increases from top to bottom). -template +template class Rect { public: using ScalarType = T; @@ -152,7 +152,7 @@ public: return *this; } - template + template Rect Cast() const { return { static_cast(x), diff --git a/source/10-common/ScopeGuard.hpp b/source/10-common/ScopeGuard.hpp index 28f3385..4e1a348 100644 --- a/source/10-common/ScopeGuard.hpp +++ b/source/10-common/ScopeGuard.hpp @@ -4,7 +4,7 @@ #include -template +template class ScopeGuard { private: TCleanupFunc mFunc; @@ -49,7 +49,7 @@ public: } }; -template +template auto GuardDeletion(T* ptr) { return ScopeGuard([ptr]() { delete ptr; diff --git a/source/10-common/SmallVector.cpp b/source/10-common/SmallVector.cpp index c38e8a7..65953f0 100644 --- a/source/10-common/SmallVector.cpp +++ b/source/10-common/SmallVector.cpp @@ -79,7 +79,7 @@ static void report_at_maximum_capacity(size_t MaxSize) { } // Note: Moving this function into the header may cause performance regression. -template +template static size_t getNewCapacity(size_t MinSize, size_t TSize, size_t OldCapacity) { constexpr size_t MaxSize = std::numeric_limits::max(); @@ -102,14 +102,14 @@ static size_t getNewCapacity(size_t MinSize, size_t TSize, size_t OldCapacity) { } // Note: Moving this function into the header may cause performance regression. -template +template void* SmallVectorBase::mallocForGrow(size_t MinSize, size_t TSize, size_t& NewCapacity) { NewCapacity = getNewCapacity(MinSize, TSize, this->capacity()); return malloc(NewCapacity * TSize); } // Note: Moving this function into the header may cause performance regression. -template +template void SmallVectorBase::grow_pod(void* FirstEl, size_t MinSize, size_t TSize) { size_t NewCapacity = getNewCapacity(MinSize, TSize, this->capacity()); void* NewElts; diff --git a/source/10-common/SmallVector.hpp b/source/10-common/SmallVector.hpp index e33a25d..3fc7519 100644 --- a/source/10-common/SmallVector.hpp +++ b/source/10-common/SmallVector.hpp @@ -55,7 +55,7 @@ class iterator_range; /// Using 64 bit size is desirable for cases like SmallVector, where a /// 32 bit size would limit the vector to ~4GB. SmallVectors are used for /// buffering bitcode output - which can exceed 4GB. -template +template class SmallVectorBase { protected: void* BeginX; @@ -97,12 +97,12 @@ protected: } }; -template +template using SmallVectorSizeType = typename std::conditional= 8, uint64_t, uint32_t>::type; /// Figure out the offset of the first element. -template +template struct SmallVectorAlignmentAndSize { alignas(SmallVectorBase>) char Base[sizeof( SmallVectorBase>)]; @@ -222,7 +222,7 @@ protected: /// Reserve enough space to add one element, and return the updated element /// pointer in case it was a reference to the storage. - template + template static const T* reserveForParamAndGetAddressImpl(U* This, const T& Elt, size_t N) { size_t NewSize = This->size() + N; if (LLVM_LIKELY(NewSize <= This->capacity())) @@ -768,7 +768,7 @@ public: } private: - template + template iterator insert_one_impl(iterator I, ArgType&& Elt) { // Callers ensure that ArgType is derived from T. static_assert( diff --git a/source/10-common/Type2ObjectMap.hpp b/source/10-common/Type2ObjectMap.hpp index 24c45f3..0976d2e 100644 --- a/source/10-common/Type2ObjectMap.hpp +++ b/source/10-common/Type2ObjectMap.hpp @@ -27,7 +27,7 @@ public: // TODO } - template + template TValue* Find() { return const_cast(const_cast(this)->Find()); } diff --git a/source/10-common/Utils.hpp b/source/10-common/Utils.hpp index fdf0f5d..82569d8 100644 --- a/source/10-common/Utils.hpp +++ b/source/10-common/Utils.hpp @@ -43,7 +43,7 @@ bool LineContains(glm::ivec2 p1, glm::ivec2 p2, glm::ivec2 candidate); bool IsColinear(glm::ivec2 p1, glm::ivec2 p2); -template +template void HashCombine(std::size_t& seed, const T& v) { seed ^= std::hash{}(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } diff --git a/source/10-common/YCombinator.hpp b/source/10-common/YCombinator.hpp index b1d2350..2da06c8 100644 --- a/source/10-common/YCombinator.hpp +++ b/source/10-common/YCombinator.hpp @@ -1,11 +1,11 @@ #pragma once -template +template struct YCombinator { // NOTE: implicit constructor allows initializing this Func func; - template + template decltype(auto) operator()(Ts&&... args) const { // NOTE: static_cast(args)... is equivalent to std::forward(args)... // written this way so that we don't have to include , as well as reducing template instanciations to help compile time -- cgit v1.2.3-70-g09d2