S
Steven T. Hatton
On page 858 of TC++PL(SE) Dr. Stroustrup states the following:
<quote>
The /typename/ keyword can also be used as an alternative to /class/ in
template declarations:
template<typename T> void f(T);
Being an indifferent typist and always short on screen space, I prefer the
shorter:
template<class T> void f(T);
</quote>
Consider now the discussion in _C++ Templates_ on page 51:
<quote>
As usual, instead of *typename* you could use the keyword *class* for
template parameters. However, *CONT* is used to define a class and must be
declared by using the keyword *class*....
</quote>
We are already in the realm of discussing the template parameters of
template template parameters. That is sufficiently beguiling on its own
without the introduction of even more subtle semantic hair-splitting. I
argue that using /typename/ everywhere it is meaningful, and
reserving /class/ for the instances where it it necessary lends clarity to
the code. The alternative merely saves keystrokes at the expense of
clarity.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell
<quote>
The /typename/ keyword can also be used as an alternative to /class/ in
template declarations:
template<typename T> void f(T);
Being an indifferent typist and always short on screen space, I prefer the
shorter:
template<class T> void f(T);
</quote>
Consider now the discussion in _C++ Templates_ on page 51:
<quote>
As usual, instead of *typename* you could use the keyword *class* for
template parameters. However, *CONT* is used to define a class and must be
declared by using the keyword *class*....
</quote>
We are already in the realm of discussing the template parameters of
template template parameters. That is sufficiently beguiling on its own
without the introduction of even more subtle semantic hair-splitting. I
argue that using /typename/ everywhere it is meaningful, and
reserving /class/ for the instances where it it necessary lends clarity to
the code. The alternative merely saves keystrokes at the expense of
clarity.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell