use fold expression, forwarding reference

This commit is contained in:
Garux 2021-01-29 05:12:20 +03:00
parent abc666ab7f
commit b9d5f091e0
2 changed files with 4 additions and 6 deletions

View File

@ -113,10 +113,9 @@ std::size_t write( const char* buffer, std::size_t length ){
} }
template<typename ... Args> template<typename ... Args>
StringOutputStream& operator()( const Args& ... args ){ StringOutputStream& operator()( Args&& ... args ){
clear(); clear();
using expander = int[]; ( *this << ... << std::forward<Args>( args ) );
(void)expander{ 0, ( (void)( *this << args ), 0 ) ... };
return *this; return *this;
} }

View File

@ -56,10 +56,9 @@ public:
} }
template<typename ... Args> template<typename ... Args>
StringFixedSize& operator()( const Args& ... args ){ StringFixedSize& operator()( Args&& ... args ){
clear(); clear();
using expander = int[]; ( *this << ... << std::forward<Args>( args ) );
(void)expander{ 0, ( (void)( *this << args ), 0 ) ... };
return *this; return *this;
} }