[v3] PATCH: PR 20599 (variadic templates, take two) (4/4)
Douglas Gregor
doug.gregor@gmail.com
Tue Sep 19 14:56:00 GMT 2006
This patch addresses PR c++/20599 by introducing support for variadic
templates:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20599
This is a revised version of the patch posted previously. It
addresses several bugs in the original patch and includes changes to
libstdc++ that use variadic templates for the implementation of
Library TR1 tuples and function objects. In particular, the changes
from the first patch are:
- Warn about variadic templates by default; -Wno-variadic-templates
turns off this warning.
- Support printing parameter packs in function types (for error
messages)
- Support for nested expansion of parameter packs.
- Tighter error checking.
More information about variadic templates is available here:
http://www.generic-programming.org/~dgregor/cpp/variadic-
templates.html
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.
Tested on mainline with powerpc-apply-darwin8.7.0 and i686-pc-linux-
gnu; no new regressions. All new tests pass.
Doug Gregor
Open Systems Lab @ Indiana University
2006-09-19 Douglas Gregor <doug.gregor@gmail.com>
* include/Makefile.in: Regenerate.
* include/tr1/mu_iterate.h: Remove.
* include/tr1/tuple (_Tuple_impl): New.
(tuple): Make variadic, re-implement as shell over _Tuple_impl.
(0-element tuple): Basis case.
(2-element tuple): Handle pair methods.
(__get_helper): Remove.
(tuple_element): Reimplement with variadic templates.
(tuple_size): Ditto.
(get): Ditto.
(operator==): Use variadic templates in the signature.
(operator<): Ditto.
(operator!=): Ditto.
(operator>): Ditto.
(operator<=): Ditto.
(operator>=): Ditto.
(__stripped_tuple_type): Remove; we've inlined its behavior.
(make_tuple): Reimplement with variadic templates.
(tie): Ditto.
* include/tr1/tuple_iterate.h: Remove.
* include/tr1/bind_repeat.h: Remove.
* include/tr1/ref_wrap_iterate.h: Remove.
* include/tr1/bind_iterate.h: Remove.
* include/tr1/functional (_Weak_result_type): Add variadic
partial specializations.
(result_of): Ditto.
(__invoke): Reimplement using variadic templates.
(reference_wrapper): Reimplement operator() with variadic
templates.
(_Maybe_unary_or_binary_function): New.
(_Mem_fn): Implement for member function pointers using variadic
templates.
(placeholders): Define 30 placeholders.
(_Index_tuple): New.
(_Build_index_tuple): New.
(_No_tuple_element): New.
(_Safe_tuple_element_impl): New.
(_Safe_tuple_element): New.
(_Mu): Reimplement with variadic templates, use
_Safe_tuple_element instead of tuple_element.
(_Bind): Reimplement with variadic templates and tuples.
(_Bind_result): Ditto.
(bind): Reimplement with variadic templates.
(_Function_handler): Ditto.
(function): Ditto.
* include/tr1/functional_iterate.h: Remove.
* include/tr1/repeat.h: Remove.
* include/Makefile.am: Don't install removed headers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vt-libstdc++-tr1.patch
Type: application/octet-stream
Size: 154862 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20060919/898e32b4/attachment.obj>
More information about the Libstdc++
mailing list