From b9d5f091e03a805a4fc39461b01e21398e7f9845 Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 29 Jan 2021 05:12:20 +0300 Subject: [PATCH] use fold expression, forwarding reference --- libs/stream/stringstream.h | 5 ++--- tools/quake3/common/stringfixedsize.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/stream/stringstream.h b/libs/stream/stringstream.h index 06b0e1ae..b6969011 100644 --- a/libs/stream/stringstream.h +++ b/libs/stream/stringstream.h @@ -113,10 +113,9 @@ std::size_t write( const char* buffer, std::size_t length ){ } template -StringOutputStream& operator()( const Args& ... args ){ +StringOutputStream& operator()( Args&& ... args ){ clear(); - using expander = int[]; - (void)expander{ 0, ( (void)( *this << args ), 0 ) ... }; + ( *this << ... << std::forward( args ) ); return *this; } diff --git a/tools/quake3/common/stringfixedsize.h b/tools/quake3/common/stringfixedsize.h index f1a19387..1ed59ac9 100644 --- a/tools/quake3/common/stringfixedsize.h +++ b/tools/quake3/common/stringfixedsize.h @@ -56,10 +56,9 @@ public: } template - StringFixedSize& operator()( const Args& ... args ){ + StringFixedSize& operator()( Args&& ... args ){ clear(); - using expander = int[]; - (void)expander{ 0, ( (void)( *this << args ), 0 ) ... }; + ( *this << ... << std::forward( args ) ); return *this; }