[v3] Variadic templates, third revision (3/3)
Doug Gregor
doug.gregor@gmail.com
Mon Nov 6 13:46:00 GMT 2006
On 11/6/06, Benjamin Kosnik <bkoz@redhat.com> wrote:
> My only thought is how to use the __GXX_EXPERIMENTAL_CPP0X__ macro
> with the TR1 includes that have been altered. I think that this should
> definitely happen.
>
> My suggestion is to do:
>
> #ifndef __GXX_EXPERIMENTAL_CPP0X__
> #error This file makes use of experimental C++0x features, and must be
> compiled with -std=gnu++0x.
> #endif
>
> At the top of
>
> tr1/tuple
> tr1/functional
>
> Thoughts?
The compiler only complains about the use of variadic templates
outside system headers, so we're free to use variadic templates in
libstdc++; no #ifdef necessary.
However, variadic templates will change the ABI of the TR1 facilities
that use them. For example, instead of mangling "tuple<int, float>" as
"tuple<int, float, _NullClass, _NullClass, _NullClass, _NullClass,
_NullClass, _NullClass, _NullClass, _NullClass>" (which happens now),
it will mangle as "tuple<int, float>." If this is a problem we'll
either have to do what Benjamin suggests or (*shudder*) select between
the variadic and non-variadic implementations based on
__GXX_EXPERIMENTAL_CPP0X__.
Cheers,
Doug
More information about the Libstdc++
mailing list