[C++ PATCH] Template template parameter conformace issue (PR9737)
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Apr 21 14:23:00 GMT 2003
Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> writes:
| Gabriel Dos Reis wrote:
|
| >Jason Merrill <jason@redhat.com> writes:
| >
| >| Hold on--the issue was closed with status "extension", and has been picked
| >| up by the Evolution group.
| >
| >The Evolution group (in whichi I mostly worked) s working on the
| >template-aliasing proposal which provides a better alternative. The
| >paper will be part of the post-mailing.
| >
| Do you have an idea about the time frame when we know if this proposal
| will be accepted/rejected? The template aliasing looks like a nice
| solution to the issue.
template-aliasing feature, based on the paper (document number N1449,
to appear in the Oxford post-mainling), has been discussed by the
Evolution group on 09th April 2003 at the last meeting. The Evolution
group agreed on the "template aliasing" mechanism principle. The
Evolution group suggested several possible directions for further
extensions -- including non-template aliasing which might encompass
overload set (although that is not part of the proposal). The Chair
of EWG made an explicit request for having a paper on this topic in
the post-mailing and possibly in the Kona pre-mailing.
Basically, the syntax will look like this:
* Given
template<typename T, typename Allocator>
struct vector { /* ... */ };
template<typename T, typename Allocator>
void f(vector<T, Allocator>&) { }
template<typename T>
struct my_alloc { /* ... */ };
one can say:
template<typename T>
using MyVec = vector<T, my_alloc<T> >;
template<typename T>
using F = f<T, my_alloc<T> >; // possibly with signature.
Quoteing the afterword of that paper:
Two straw polls were taken regarding syntax. A strong majority
voted to avoid the typedef template syntax, in favor of the =
syntax. A second vote indicated strong preference for the using
keyword as opposed to a word like alias or the absence of any
keyword as in the draft version of this proposal. The motivation
for using any keyword at all stemmed partly from the desire to use
a syntax that might be compatible with the non-template aliasing
direction briefly outlined above.
I would recall that the "typedef template" syntax (proposed in Herb's
paper, N1406) was along the line:
template<typename T>
typedef vector<T, my_alloc<T> > MyVec;
-- Gaby
More information about the Gcc-patches
mailing list