From 2b7c4941e5334965f21cfbc262ceb9399ea3c66e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Jun 2020 06:30:18 -0400 Subject: [PATCH] CResTypeInfo: Make use of std::move in the constructor Allows calling code to eliminate copies altogether from occurring. --- src/Core/Resource/CResTypeInfo.cpp | 12 ++++++------ src/Core/Resource/CResTypeInfo.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Core/Resource/CResTypeInfo.cpp b/src/Core/Resource/CResTypeInfo.cpp index 02cd4a26..adac8b1c 100644 --- a/src/Core/Resource/CResTypeInfo.cpp +++ b/src/Core/Resource/CResTypeInfo.cpp @@ -4,15 +4,15 @@ std::unordered_map> CResTypeInfo::smTypeMap; -CResTypeInfo::CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension) - : mType(Type) - , mTypeName(rkTypeName) - , mRetroExtension(rkRetroExtension) +CResTypeInfo::CResTypeInfo(EResourceType type, TString typeName, TString retroExtension) + : mType(type) + , mTypeName(std::move(typeName)) + , mRetroExtension(std::move(retroExtension)) { #if !PUBLIC_RELEASE - ASSERT(smTypeMap.find(Type) == smTypeMap.end()); + ASSERT(smTypeMap.find(type) == smTypeMap.cend()); #endif - smTypeMap.insert_or_assign(Type, std::unique_ptr(this)); + smTypeMap.insert_or_assign(type, std::unique_ptr(this)); } bool CResTypeInfo::IsInGame(EGame Game) const diff --git a/src/Core/Resource/CResTypeInfo.h b/src/Core/Resource/CResTypeInfo.h index 85651246..8bbfcb3b 100644 --- a/src/Core/Resource/CResTypeInfo.h +++ b/src/Core/Resource/CResTypeInfo.h @@ -28,7 +28,7 @@ class CResTypeInfo static std::unordered_map> smTypeMap; // Private Methods - CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension); + CResTypeInfo(EResourceType type, TString typeName, TString retroExtension); ~CResTypeInfo() = default; friend struct std::default_delete;