C
Schlangenmensch schrieb:
Mir aus den Fingern sagenu? Wie wäre es erstmal mit ein bisschen eigener recherche bevor du andere so angehst.
Hier mal ein Auszug von Stan Lippman https://blogs.msdn.microsoft.com/slippman/2004/08/11/why-c-supports-both-class-and-typename-for-type-parameters/
The committee decided that a new keyword was just the ticket to get the compiler off its unfortunate obsession with expressions. The new keyword was the self-describing typename. When applied to a statement, such as,
typename T::A* a6; // declare pointer to T’s A
it instructs the compiler to treat the subsequent statement as a declaration. Since the keyword was on the payroll, heck, why not fix the confusion caused by the original decision to reuse the class keyword. Of course, given the extensive body of existing code and books and articles and talks and postings using the class keyword, they chose to also retain support for that use of the keyword as well. So that’s why you have both.
Na, das ist das genau Gegenteil dessen, das du zuvor geschrieben hast:
Aber um dem Keywort nicht mehrere Bedeutungen zu geben, hat man hinterher "typename" eingeführt.
typename wurde aus anderen Grund eingeführt. Und nachdem es einmal da war, hat man sich entschlossen, es auch in Templateparameterlisten an Stelle von class zuzulassen.
Und meine Kritik bezog sich eben nicht primär darauf, dass dein Beitrag einfach falsch war, sondern schlicht sinnlos, was man bereits ohne Kenntnis von Fakten erkennen kann.