Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-01-18 03:06:50


On Mon, Jan 16, 2017 at 11:41 AM, Richard Hodges <hodges.r_at_[hidden]> wrote:

> Sorry to chime in so late in the discussion.
>
> What about a syntax similar to this?
>
> int main()
> {
> auto s = join("Hello ", ", World.", " The hex for ", 58, " is ",
> std::hex, 58);
> std::cout << s << std::endl;
>
> s = join(separator(" : "), "a", "b", std::hex, 200 ,
> std::quoted("banana"));
> std::cout << s << std::endl;
>
> }
>
> Which would produce the following output:
>
> Hello , World. The hex for 58 is 3a
> a : b : c8 : “banana"
>

The syntax is fine but it's missing an appending variant, like append(s,
"A", "B", 42);
This variant is important as it (also) allows you to reuse existing storage.


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