Source sweep: Replace std::ostringstream when used with a single append

This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
This commit is contained in:
Sebastian Holtermann
2019-08-23 12:21:46 +02:00
parent 19612dffd2
commit 3b2b02825d
24 changed files with 92 additions and 153 deletions
+5 -4
View File
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestMemCheckCommand.h"
#include <sstream>
#include <string>
#include <vector>
#include "cmCTest.h"
@@ -44,8 +44,9 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues(
cmCTestGenericHandler* handler)
{
if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
std::ostringstream str;
str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str());
this->Makefile->AddDefinition(
this->Values[ctm_DEFECT_COUNT],
std::to_string(
static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount()));
}
}