From 9925925b6fe992242a9a96248cf093a987b2cd92 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 11 Jun 2020 13:14:33 -0400 Subject: [PATCH] TResPtr: Use in-class initializers where applicable --- src/Core/Resource/TResPtr.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Core/Resource/TResPtr.h b/src/Core/Resource/TResPtr.h index 738dc4b8..7605095e 100644 --- a/src/Core/Resource/TResPtr.h +++ b/src/Core/Resource/TResPtr.h @@ -6,20 +6,17 @@ template class TResPtr { - ResType *mpRes; + ResType *mpRes = nullptr; public: - TResPtr() - : mpRes(nullptr) {} + constexpr TResPtr() = default; TResPtr(void *pPtr) - : mpRes(nullptr) { *this = pPtr; } TResPtr(const TResPtr& rkSource) - : mpRes(nullptr) { *this = rkSource; } @@ -30,7 +27,7 @@ public: mpRes->Release(); } - inline void Serialize(IArchive& rArc) + void Serialize(IArchive& rArc) { CAssetID ID = (mpRes && !rArc.IsReader() ? mpRes->ID() : CAssetID::InvalidID(rArc.Game())); rArc.SerializePrimitive(ID, 0); @@ -42,29 +39,29 @@ public: } } - inline void Delete() + void Delete() { // use with caution! this function exists because not all resources are cached currently delete mpRes; mpRes = nullptr; } - inline ResType* RawPointer() const + ResType* RawPointer() const { return mpRes; } - inline operator ResType*() const + operator ResType*() const { return mpRes; } - inline ResType& operator*() const + ResType& operator*() const { return *mpRes; } - inline ResType* operator->() const + ResType* operator->() const { return mpRes; }