![]() |
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2006-09-26 18:04:29
Doug Gregor wrote:
> A while ago I announced the availability of an implementation of
> "variadic templates" for GCC. Variadic templates eliminate a huge
> amount of redundancy in several Boost libraries (including some that
> have gone into TR1), such as tuples, function, bind, mem_fn, and MPL.
> I have now completed the compiler (everything I've thought to try
> works) and completely reimplemented TR1's <tuple> and <functional>
> headers using variadic templates. The resulting code is much smaller,
> clean, and compiles significantly faster that the previous versions.
> Compiler binaries and sources, both including the implementation of
> TR1, are available here:
>
> http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.html
>
> I think variadic templates are a big step forward for C++ libraries
> that deal with function objects, forwarding, and type-lists. If
> you're interested, please read the documentation, hack some code with
> the compiler, and tell your local C++ committee representative to
> vote for variadic templates in C++0x :)
FWIW, I'll add a quick word of support for this feature. I ran into this very
issue with my implementation of the 'super_string' class where I wanted to
have an unlimited number of template function parameters for functions like
type conversion and and formatted output. It's painful to write/test all the
different overloadings to an 'arbitrary level'. Honestly, I punted and didn't
write as many overloads as I should have...luckily no one has complained - yet
;-) I looked at your spec when you first posted and I believe it would solve
my issue quite nicely.
Thanks for doing this.
Jeff
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk