mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-16 18:15:42 +02:00
Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path
ReusableStringStream holds a std::ostringstream internally, but only exposes the ostream interface. It caches a pool of ostringstreams in a vector which is currently global, but will be made thread-local. Altogether this should enable both runtime and compile-time benefits. although more work is needed to realise the compile time opportunities.
This commit is contained in:
@@ -543,9 +543,9 @@ namespace Catch {
|
||||
colour( _colour )
|
||||
{}
|
||||
SummaryColumn addRow( std::size_t count ) {
|
||||
std::ostringstream oss;
|
||||
oss << count;
|
||||
std::string row = oss.str();
|
||||
ReusableStringStream rss;
|
||||
rss << count;
|
||||
std::string row = rss.str();
|
||||
for( auto& oldRow : rows ) {
|
||||
while( oldRow.size() < row.size() )
|
||||
oldRow = ' ' + oldRow;
|
||||
|
Reference in New Issue
Block a user