Boost logo

Boost :

Subject: Re: [boost] Interest in another formatting library ?
From: Roberto Hinz (robhz786_at_[hidden])
Date: 2017-06-24 14:42:11


On Sat, Jun 24, 2017 at 4:28 AM, Frédéric Bron via Boost <
boost_at_[hidden]> wrote:

> >> Is there space for another formatting library in Boost?
> >> Anyone interest in this one?
> >
> > I'd be interested in one. I looked at the documentation, you might want
> to
> > outline how it does compare to boost.format. But besides that, it looks
> > quite interesting.
>
> Also, how does it compare to fmt?
> https://github.com/fmtlib/fmt
> Thanks,
> Frédéric
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/
> mailman/listinfo.cgi/boost
>

Hi, happy you two are interest.

I confess that I never used fmt, hence I don't know it deeply. So I will
just list some things boost.stringify provides that I think fmt and
boost.format do not:

(1) When adding new input types, the user will be able to create new facets
and facets categories and formatting options specific to this new input
type.

(2) boost.stringify (will) support many destination types and it is easy to
add user-defined types. Qt users, for example, might want to use it to
write to QString.

(3) It is able to append directly to std::basic_string. You don't have to
write to an intermediate string to then append it. boost.stringify
calculates the required amount of characters and set an adequate capacity,
so that only one memory allocation happens at most. The desire of such
ability was expressed some time ago. (
http://boost.2283326.n4.nabble.com/Variadic-append-for-std-string-tt4690743.html
).

(4) char32_t is used in facets that specify characters ( like the fill
character, and, in future, the punctuation and digits caracters ). So that
you are not limited to the ascci characers when the destination character
type is char. ( By default it is converted to utf-8, but in future the user
will able be customize this translation. )
There is a another and more subtle rationale for this: the same facet
should work regardless of the destination character type, which, for
example, in Windows usually wchar_t, while in others OS its usually char.
This this helps to reduce the duplication of code and the use of #if/#else.

(5) boost.stringify aims (todo) to support translation from utf-8 to utf-16
and vice-versa, and other encodings. For example:

      boost::stringify::write_to(destination) ("aaa", u"bbb", U"ccc",
L"ddd");

will work regardless of the destination character type. This also has to do
the previous rationale.

(6) boost.stringify support joins
<https://robhz786.github.io/stringify/doc/html/input_types/input_types.html#input_types.input_types.special_input_types.joins>
.

kind regards
Roberto


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