Boost logo

Boost :

Subject: Re: [boost] Proposal: Add Loki Library's SafeFormat to Boost:
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2009-01-01 06:26:30


> The last Loki thread I see here is the one from 2002 discussing adding
> Loki to Boost. I asked Andrei once about doing that specifically for
> the Loki SafeFormat functions (FPrint, Printf, and SPrintf) and he
> said FPrintf wasn't good enough yet.
>
> However, I find all of them very useful and would love to see them
> added to the Boost library
>
> I know Boost has Format now, but SafeFormat has some advantages over
> Boost.Format, one of which is that FPrintf can be output to C++
> streams as well as to FILE pointers--very handy when one is gradually
> converting legacy code to using C++ streams. In addition, I find the
> SafeFormat family much easier to use than Boost.Format.
>
> Andrei's original comments regarding FPrintf's shortcomings are here:
>
> https://sourceforge.net/forum/message.php?msg_id=4525195
>
> His "Dr. Dobb's Journal" article describing SafeFormat is here:
>
> http://www.ddj.com/cpp/184401987

I know this has been touched before (at least during the library in a week
sessions at BoostCon 2007/2008). Furthermore, the topic of adding some
output formatting facilities to Boost pops up occasionally.

So, please let me use this thread for a selfless plug :-P. Boost already has
a versatile and powerful output formatting library: Spirit V2!

You might think, well Spirit used to be a parser library, not something
usable for output formatting. But with the event of Spirit V2 this has
changed. Spirit V2 now is not only a parser generator library anymore
(Spirit Classic, aka V1.x, now called Spirit.Qi), but got extended to cover
the domain of (output) generators as well (Spirit.Karma). Admittedly, the
docs are not complete yet, but if you know how to build a parser using
Spirit.Qi you shouldn't have problems using Spirit.Karma either. Everything
is in the SVN (and in Boost V1.37, BTW) and the examples should provide a
fairly good starting point.

Regards Hartmut


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