mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
|
||||
int cmDependsJava_yyparse(yyscan_t yyscanner);
|
||||
|
||||
@@ -22,7 +23,7 @@ cmDependsJavaParserHelper::cmDependsJavaParserHelper()
|
||||
|
||||
CurrentClass tl;
|
||||
tl.Name = "*";
|
||||
this->ClassStack.push_back(tl);
|
||||
this->ClassStack.push_back(std::move(tl));
|
||||
}
|
||||
|
||||
cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
|
||||
@@ -175,7 +176,7 @@ void cmDependsJavaParserHelper::StartClass(const char* cls)
|
||||
{
|
||||
CurrentClass cl;
|
||||
cl.Name = cls;
|
||||
this->ClassStack.push_back(cl);
|
||||
this->ClassStack.push_back(std::move(cl));
|
||||
|
||||
this->CurrentDepth++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user