typesafe printf with variadic template

It seems a common example for C++11 and variadic templates is a typesafe printf which is supposed to obsolete things like Boost.Format. However there doesn't seem to be one usable out of the box. If this is really a large improvement shouldn't this facility be in boost?

Hi Michael, On 2013-11-14 19:20, Michael Marcin wrote:
It seems a common example for C++11 and variadic templates is a typesafe printf which is supposed to obsolete things like Boost.Format. However there doesn't seem to be one usable out of the box.
If this is really a large improvement shouldn't this facility be in boost?
I have a typesafe printf implementation based on Metaparse. It takes a
different approach as the common example for variadic templates. It adds
type checking to the non-safe printf and has no runtime overhead. The
current implementation generates code using macros instead of variadic
templates, but I'm planning to extend it in the near future.
You can use it like this:
printf

On 14 Nov 2013 at 12:20, Michael Marcin wrote:
It seems a common example for C++11 and variadic templates is a typesafe printf which is supposed to obsolete things like Boost.Format. However there doesn't seem to be one usable out of the box.
If this is really a large improvement shouldn't this facility be in boost?
VS2013 doesn't implement enough of C++11 yet to implement typesafe printf. Once it does (VS2014), I'm sure we'll see it appear somewhere (maybe in the standard library rather than in Boost. Standard libraries already define more typesafe C functions when __cplusplus is defined). Niall -- Currently unemployed and looking for work. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/

On Thu, Nov 14, 2013 at 2:37 PM, Niall Douglas
On 14 Nov 2013 at 12:20, Michael Marcin wrote:
It seems a common example for C++11 and variadic templates is a typesafe printf which is supposed to obsolete things like Boost.Format. However there doesn't seem to be one usable out of the box.
If this is really a large improvement shouldn't this facility be in boost?
VS2013 doesn't implement enough of C++11 yet to implement typesafe printf. Once it does (VS2014), I'm sure we'll see it appear somewhere (maybe in the standard library rather than in Boost. Standard libraries already define more typesafe C functions when __cplusplus is defined).
Zhihao Yuan has been working on such a proposal for the standard library. His most recent paper is http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3716.html, but he got a lot of feedback from LEWG in Chicago, so there will be major revision, presumably in time for the February meeting. --Beman
participants (4)
-
Abel Sinkovics
-
Beman Dawes
-
Michael Marcin
-
Niall Douglas