Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2019-11-28 14:32:49

Vinnie Falco wrote:
> How about a free function `concat(...)`
> which allows the caller to optionally specify the maximum capacity of
> the resulting string

See also
IMO, that paper unnecessarily combines string concatenation
with number-formatting, but it is still interesting to look at.
It converts all of its arguments to string_views, sums the
lengths (at run time), allocates a std::string of that length,
and copies the arguments into it. You could extend that to
(a) permit the return type to be specified as an additional
template parameter, and (b) default that return type to a
static_string if the capacities of all the arguments are finite.

Regards, Phil.

Boost list run by bdawes at, gregod at, cpdaniel at, john at