[Solved] Why C++17 have two keywords(class and typename) for the same purpose in templates


This is a subjective question. Personally I would tend to agree that having class here at all is poor form, and typename should have been the only keyword allowed.

But that’s just my opinion. Perhaps this usage of class will be deprecated in the future; perhaps there are sufficient people who like to write class for whatever reason, that it won’t be.

At the end of the day, it’s hardly the most pressing issue to affect C++, which is probably the real reason that the committee ended up relaxing restrictions rather than adding new ones.

If you feel strongly that this usage of class should be deprecated, feel free to propose this to the working group!

By the way, the usage of static you refer to was actually undeprecated in C++11.

1

solved Why C++17 have two keywords(class and typename) for the same purpose in templates