template < typename>

0

Cześć :)
Spotkałem się z następującymi "przedrostkami" deklaracji:

template <T>
template <class T>
template <typename T>

Czym rózni się jedna od drugiej?

3

Poprawna jest druga i trzecia.

Summary: Stroustrup originally used class to specify types in templates to avoid introducing a new keyword. Some in the committee worried that this overloading of the keyword led to confusion. Later, the committee introduced a new keyword typename to resolve syntactic ambiguity, and decided to let it also be used to specify template types to reduce confusion, but for backward compatibility, class kept its overloaded meaning.

1 użytkowników online, w tym zalogowanych: 0, gości: 1