This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: C++ PATCH: PR 20599 (1/3)
On Sep 25, 2006, at 9:57 AM, Douglas Gregor wrote:
Since the policy we're agreeing on excludes variadic templates from
consideration, I'd like to see this patch discussed on its own
merits. Variadic templates are a huge win for libstdc++. They take
the ugliest parts of libstdc++, the TR1 function objects and tuple
implementations, and improve them greatly, both for libstdc++
maintainers and for users. We can eliminate more than 50k of
repetitive code from libstdc++, replacing a barely-maintainable
mess of preprocessor metaprogramming with a simple, concise
implementation that compiles in less than 1/10th of the time.
Moreover, the variadic-template--enabled libstdc++ provides a
better user experience. The current implementation limits the
number of parameters to function/bind/mem_fn/etc. to 10; try to use
11 parameters and you get a big, ugly error message. We can't even
bump up the maximum number of parameters supported by the library
(we've tried), because compile times become prohibitive.
GCC already contains other extensions meant to improve libstdc++,
such as extern templates and strong using directives. The former
helps improve compile times (among other benefits) and has now
become part of the C++0x working draft. The latter helps improve
the user experience for libstdc++'s debug mode. Varadic templates
do both, and drastically simplify one of the worst parts of libstdc++.
I was doing my best to sit on my hands on this one, hoping to see
others chime in on this. One hand got free, and then the other one
got free, and I just couldn't contain them any longer. ;-)
Imho there are two poster childs for exceptions to Mark's good
guidelines:
1. rvalue reference.
2. variadic templates.
And I think the first one is relatively firm for C++0X, and we will
not need to make an exception for it within the next month or seven.
The second I think has a better than 50/50 shot at C++0X, and even if
it fails, has such a strong positive impact on libstdc++ that (like
extern template) I think deserves special attention. Variadic
templates is an area that is just begging for gcc to lead instead of
follow.
-Howard