[v3] PATCH: PR 20599 (variadic templates, take two) (4/4)
Chris Jefferson
chris@bubblescope.net
Tue Sep 19 15:45:00 GMT 2006
On 19/09/06, Douglas Gregor <doug.gregor@gmail.com> wrote:
> This patch addresses PR c++/20599 by introducing support for variadic
> templates:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20599
>
> This is part 4 of 4. It contains changes to libstdc++'s TR1
> implementation to make full use of variadic templates, eliminating
> all of the preprocessor metaprogramming that we're using now.
>
I am only looking at the tuple code here (which is the only part I
have personal experience with). At first glance everything appears
very good.
I have one very, very minor point. The TR1 standard requires the
prototype for 'get' be:
template <int I, class T1, class T2, ..., class TN>
RJ get(tuple<T1, T2, ..., TN>& t);
whereas the prototype used here is involved in a (very clever) trick
to get an O(1) get. This could be fixed simply by wrapping get.
There is the general problem with this kind of code, which is that it
can generate a lot of very small functions which we can get in the way
of debugging and running code without optimisation. However, this is a
continuing problem with C++ and here I think the gains clearly
outweigh the losses.
Chris
More information about the Libstdc++
mailing list