template <typename ty_char, /* template <typename> typename ... tys_str
↑ I cant define the parameter pack
to express that paramater pack is constrainted to basic_string classes with a template argument */ >
void
concat_strings( basic_string<ty_char> & _buffer,
tys_str<ty_char> const & ... _string )
{
static_assert( is_same<basic_string<ty_char>::size_type, size_t>::value );
size_t l_min_size = 0;
for( auto const & l_string : {_string...} )
{
l_min_size += l_string.size( );
}
_buffer.reserve( l_min_size );
for( auto const & l_string : {_string...} )
{
_buffer += _string;
}
}
I have been trying to implement the function which receives a reference of the buffer and concatenates other constant strings. I want the function receives the arguments without any array allocation. However, I feel the function gets more messy and totally wrong. Is it a proper way to implement the function?