On Fri, 12 Sep 2003 15:43:16 +0200, Ulrich Eckhardt
<> wrote:
>Curt wrote:
>> Ulrich Eckhardt <> wrote :
>> [explicit 'typename' required]
>>
>> I wonder what ivory-tower insanely contrived "problem" it solves.
>>
>Hmmm, I think I'm stuck, I don't remember the rest of it. 
>Anyway, I set a follow up to clc++, maybe the amassed brainpower there can
>help.
There are a number of advantages that I can think of:
1. It is obvious by looking at source code that a particular dependent
name is supposed to be a type, rather than a static member or whatever
(this doesn't apply to the original example).
2. It allows syntax checking of template definitions that haven't been
instantiated. Experience has shown that whenever any significant
template source code base has been run through a compiler with
template syntax checking for the first time, a large number of errors
and typos have been found in templates that hasn't yet been
instantiated by the authors during testing.
3. It is enforced that a particular dependent name is be a type,
template or whatever, rather than depending upon a particular
instantiation context.
4. As for why typename is still required when it is "obvious" that a
typename is being named (e.g. in a typedef), consistency and ease of
parsing are the reasons.
There are enough pragmatic people in the C++ standards committee to
ensure that "ivory-tower insanely contrived "problem" solving"
features don't tend to make it into the standard.
Tom