Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: damien.buhl_at_[hidden]
Date: 2017-01-13 18:23:57

What about the typesafe sprintf from Abel regarding this discussion, a library based on it could forward to eirher compiletime/runtime version and benefit from the ease of the printf syntax.

I think the api of sprintf is simple and good it just shall be made typesafe and string concept overloaded, like a formatted print algorithm.

Any other new api will fail as boost.format, boost format is good but hasn't gained much traction because the added value balanced with it's complexity doesn't make it better than sprintf in usage.

I mean : str(boost::format("%1%") % myvar)) is not so much cooler than streams formatting or sprintf. So why not stick with a modernized sprintf for formatting?

Damien Buhl
Alias daminetreg
> On 13 Jan 2017, at 17:29, Peter Dimov <lists_at_[hidden]> wrote:
> 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);
>> >
>> >
>> >
> 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. 
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at