Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Peter Dimov (lists_at_[hidden])
Date: 2017-01-13 11:29:33


Christof Donat wrote:
> Am 12.01.2017 20:05, schrieb Olaf van der Spek:
> > I like fmt's syntax much more:
> >
> > string s = fmt::format("The answer is {}", 42);
> >
> >
> > http://fmtlib.net/latest/index.html

fmtlib looks pretty cool. In fact it's basically a superset of my private
library. Some of the design decisions aren't the same but the overall style
is very similar.

> Format will have to parse the format string at runtime and then chose
> dynamically the function to stringify the number.

It does, of course, parse the format string, but I'm not sure what you mean
by "choose function dynamically." The above basically does something like

    os << "The answer is ";
    os << 42;
    return os.str();

using one virtual call for the os << 42 part.


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