Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Christof Donat (cd_at_[hidden])
Date: 2017-01-13 10:30:09


Hi,

Am 12.01.2017 20:05, schrieb Olaf van der Spek:
> On Wed, Jan 11, 2017 at 5:45 PM, Christof Donat <cd_at_[hidden]> wrote:
>> Basically the Idea of that kind of interface should work as well for a
>> high performance solution. Let's start with this syntax:
>>
>> auto myString = (cat() + "Hello"s + " "s + "World! "s + 42).str();
>>
>
> I like fmt's syntax much more:
>
> string s = fmt::format("The answer is {}", 42);
>
>
> http://fmtlib.net/latest/index.html
>
> I really don't get why we should bother with the (cat(...)).str() bit.

Format will have to parse the format string at runtime and then chose
dynamically the function to stringify the number. The cat() aproach can
be implemented to do that choice at compiletime. So no string parsing
and not dynamic choice of formating functions. We were talking about
performance in this chapter, weren't we?

Christof


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