CPackage: std::move strings in constructor where applicable
Allows calling code to completely avoid copies.
This commit is contained in:
parent
bf9be7f2ad
commit
36e005844f
|
@ -62,7 +62,7 @@ bool CGameProject::Serialize(IArchive& rArc)
|
||||||
TString PackageName = packagePath.GetFileName(false);
|
TString PackageName = packagePath.GetFileName(false);
|
||||||
TString PackageDir = packagePath.GetFileDirectory();
|
TString PackageDir = packagePath.GetFileDirectory();
|
||||||
|
|
||||||
auto pPackage = std::make_unique<CPackage>(this, PackageName, PackageDir);
|
auto pPackage = std::make_unique<CPackage>(this, std::move(PackageName), std::move(PackageDir));
|
||||||
const bool PackageLoadSuccess = pPackage->Load();
|
const bool PackageLoadSuccess = pPackage->Load();
|
||||||
mPackages.push_back(std::move(pPackage));
|
mPackages.push_back(std::move(pPackage));
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ class CPackage
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPackage() = default;
|
CPackage() = default;
|
||||||
CPackage(CGameProject *pProj, const TString& rkName, const TString& rkPath)
|
CPackage(CGameProject *pProj, TString rkName, TString rkPath)
|
||||||
: mpProject(pProj)
|
: mpProject(pProj)
|
||||||
, mPakName(rkName)
|
, mPakName(std::move(rkName))
|
||||||
, mPakPath(rkPath)
|
, mPakPath(std::move(rkPath))
|
||||||
, mCacheDirty(true)
|
, mCacheDirty(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue