CResTypeInfo: Make use of std::move in the constructor
Allows calling code to eliminate copies altogether from occurring.
This commit is contained in:
parent
8f70b20312
commit
2b7c4941e5
|
@ -4,15 +4,15 @@
|
||||||
|
|
||||||
std::unordered_map<EResourceType, std::unique_ptr<CResTypeInfo>> CResTypeInfo::smTypeMap;
|
std::unordered_map<EResourceType, std::unique_ptr<CResTypeInfo>> CResTypeInfo::smTypeMap;
|
||||||
|
|
||||||
CResTypeInfo::CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension)
|
CResTypeInfo::CResTypeInfo(EResourceType type, TString typeName, TString retroExtension)
|
||||||
: mType(Type)
|
: mType(type)
|
||||||
, mTypeName(rkTypeName)
|
, mTypeName(std::move(typeName))
|
||||||
, mRetroExtension(rkRetroExtension)
|
, mRetroExtension(std::move(retroExtension))
|
||||||
{
|
{
|
||||||
#if !PUBLIC_RELEASE
|
#if !PUBLIC_RELEASE
|
||||||
ASSERT(smTypeMap.find(Type) == smTypeMap.end());
|
ASSERT(smTypeMap.find(type) == smTypeMap.cend());
|
||||||
#endif
|
#endif
|
||||||
smTypeMap.insert_or_assign(Type, std::unique_ptr<CResTypeInfo>(this));
|
smTypeMap.insert_or_assign(type, std::unique_ptr<CResTypeInfo>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CResTypeInfo::IsInGame(EGame Game) const
|
bool CResTypeInfo::IsInGame(EGame Game) const
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CResTypeInfo
|
||||||
static std::unordered_map<EResourceType, std::unique_ptr<CResTypeInfo>> smTypeMap;
|
static std::unordered_map<EResourceType, std::unique_ptr<CResTypeInfo>> smTypeMap;
|
||||||
|
|
||||||
// Private Methods
|
// Private Methods
|
||||||
CResTypeInfo(EResourceType Type, const TString& rkTypeName, const TString& rkRetroExtension);
|
CResTypeInfo(EResourceType type, TString typeName, TString retroExtension);
|
||||||
~CResTypeInfo() = default;
|
~CResTypeInfo() = default;
|
||||||
friend struct std::default_delete<CResTypeInfo>;
|
friend struct std::default_delete<CResTypeInfo>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue