Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Olaf van der Spek (ml_at_[hidden])
Date: 2016-12-29 03:56:18


On Thu, Dec 29, 2016 at 1:43 AM, Nat Goodspeed <nat_at_[hidden]> wrote:
> I think what's desired here is a two-pass approach in which append() or
> concat() or whatever first figures out the final length required, allocates
> that much storage, then appends into it with no further expansion.
>
> When we say it should understand two kinds of string_view, etc., I assume
> that the catch-all case for each arg would be "anything that can be treated
> as a range of char_type."

Sounds good.. but if you've got an input range (not readable twice)
then you can no longer apply the two-pass optimization.
The interface certainly allows it.

-- 
Olaf

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk