Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-08-07 16:05:25

Hi Doug,

First, let me say it is really nice to see this implemented.

> template<typename T, typename... Args>
> void printf(const char* s, const T& value, const Args&... args) {
> while (*s) {
> if (*s == '%' && *++s != '%') {
> std::cout << value;
> return printf(++s, args...);
> }
> std::cout << *s++;
> throw std::runtime_error("extra arguments provided to printf");
> }

> Are variadic templates worthwhile? Will they help us build better,
> cleaner Boost libraries in the future?

I think the answer to that is definitely yes. There's quiye a few
libraries in boost that use the preprocessor in lack of something better.

> Should we bring variadic
> templates to the C++ committee,

It does seem to simplify quite a few libraries, doesn't it.

As for the printf-example, then it might be reasonable to consider
code-bloat a little. If you don't watch out a little, it might generate
a lot of code.


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