template syntax

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 31 00:08:16 UTC 2019


On 1/30/19 4:57 PM, Walter Bright wrote:
> On 1/30/2019 1:28 PM, H. S. Teoh wrote:
>> Recent versions of C++ ostensibly have "solved" that problem, so that no
>> intervening space is needed anymore.
> 
> I implemented the lexer hack back in the 90's, but had to back it out to 
> get it through the C++98 test suite. Then, I had to add it back in to 
> match later C++ Standards :-)
> 
> 
>> Of course, that doesn't really solve the problem; it only introduces
>> more complexity in the parser / lexer, and in all likelihood more
>> pathological corner cases to come back and bite you when you least
>> expect it.
> 
> I think the .template syntax is to work around such a corner case.

Don't forget "typename" and "::template", beautifully combined here:

typedef typename Allocator::template rebind<Mapped>::other 
mapped_type_allocator;


Andrei



More information about the Digitalmars-d mailing list