diff options
author | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-25 13:59:33 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <pa.solodovnikov@tensor.ru> | 2018-01-26 10:24:45 (GMT) |
commit | c85bb007df37aad9f20355cdf4d7ca9af562cb20 (patch) | |
tree | 97027a278ef535cbb277ae91aa4c2eb620cb6978 /Source/cmInstallTargetGenerator.cxx | |
parent | fa3ac83af0edf958d26b246109db6e3d6d128d70 (diff) | |
download | CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.zip CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.gz CMake-c85bb007df37aad9f20355cdf4d7ca9af562cb20.tar.bz2 |
Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 814dc4f..a9b4908 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -132,8 +132,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (this->ImportLibrary) { std::string from1 = fromDirConfig + targetNameImport; std::string to1 = toDir + targetNameImport; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { @@ -176,13 +176,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (targetNameReal != targetName) { std::string from2 = fromDirConfig + targetNameReal; std::string to2 = toDir += targetNameReal; - filesFrom.push_back(from2); - filesTo.push_back(to2); + filesFrom.push_back(std::move(from2)); + filesTo.push_back(std::move(to2)); } } - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } } else { std::string targetName; @@ -198,8 +198,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNameImport; std::string to1 = toDir + targetNameImport; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { @@ -223,8 +223,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // Tweaks apply to the binary inside the bundle. std::string to1 = toDir + targetNameReal; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } else if (this->Target->IsCFBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; @@ -235,8 +235,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNameBase; std::string to1 = toDir + targetName; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } else { bool haveNamelink = false; |