Subject: Re: [boost] Variadic append for std::string
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2017-01-23 03:55:22
> On 20 Jan 2017, at 20:03, Christof Donat <cd_at_[hidden]> wrote:
I agree with the principle of least surprise, it is something I am also applying. :) I think that "join" is less surprising, but it looks like the evidence is against me, so I stand down.
> auto my_new_str = (cat() + "Hello" + ", " + "World" + "!").str();
> Here cat() would return a string factory type, that collects all the stuff, that you "add" to it. In str() it allocates a string big enough for all the content and renders in there. Well compared to
> auto my_new_str = concat("Hello", ", ", "World", "!").str();
> Judge for yourself, which one is easier for the user to understand.
Oh, I never questioned this. I see the obvious technical and stylistic advantages of the latter. I am just arguing about names.
Your last proposal was without the ".str()", which made more sense:
auto my_new_str = concat("Hello", ", ", "World", "!");
I hope this was just a typo.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk