replaced some `std::ostringstream` usage with `std::to_string()` (#4719)

This commit is contained in:
Oliver Stöneberg 2023-01-16 22:05:33 +01:00 committed by GitHub
parent a102ff3c2f
commit 124668979c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 20 deletions

View File

@ -272,9 +272,7 @@ unsigned int ProcessExecutor::check()
resultOfCheck = fileChecker.check(iFile->first);
}
std::ostringstream oss;
oss << resultOfCheck;
pipewriter.writeEnd(oss.str());
pipewriter.writeEnd(std::to_string(resultOfCheck));
std::exit(EXIT_SUCCESS);
}

View File

@ -32,7 +32,6 @@
#include <iostream>
#include <map>
#include <memory>
#include <sstream> // IWYU pragma: keep
#include <stack>
#include <utility>
@ -2422,9 +2421,7 @@ void TemplateSimplifier::simplifyTemplateArgs(Token *start, Token *end)
tok->deleteNext();
tok->deleteThis();
tok->deleteNext();
std::ostringstream sz;
sz << 1;
tok->str(sz.str());
tok->str(std::to_string(1));
again = true;
}
@ -2433,9 +2430,7 @@ void TemplateSimplifier::simplifyTemplateArgs(Token *start, Token *end)
tok->deleteNext();
tok->deleteThis();
tok->deleteNext();
std::ostringstream ostr;
ostr << (Token::getStrLength(tok) + 1);
tok->str(ostr.str());
tok->str(std::to_string(Token::getStrLength(tok) + 1));
again = true;
}

View File

@ -213,11 +213,7 @@ bool TestFixture::assertEquals(const char * const filename, const unsigned int l
bool TestFixture::assertEquals(const char * const filename, const unsigned int linenr, const long long expected, const long long actual, const std::string &msg) const
{
if (expected != actual) {
std::ostringstream ostr1;
ostr1 << expected;
std::ostringstream ostr2;
ostr2 << actual;
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
assertEquals(filename, linenr, std::to_string(expected), std::to_string(actual), msg);
}
return expected == actual;
}
@ -260,11 +256,7 @@ void TestFixture::todoAssertEquals(const char* const filename, const unsigned in
void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted, const long long current, const long long actual) const
{
std::ostringstream wantedStr, currentStr, actualStr;
wantedStr << wanted;
currentStr << current;
actualStr << actual;
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
todoAssertEquals(filename, linenr, std::to_string(wanted), std::to_string(current), std::to_string(actual));
}
void TestFixture::assertThrow(const char * const filename, const unsigned int linenr) const