Redian新闻
>
Any difference between class and typename identifier?
avatar
Any difference between class and typename identifier?# Programming - 葵花宝典
h*i
1
C++ has two ways to specify a formal parameter for a template:
class identifier
typename identifier
are there any difference between thetwo notations? If so, what are they?
avatar
t*t
2
in template parameter no difference.

【在 h**i 的大作中提到】
: C++ has two ways to specify a formal parameter for a template:
: class identifier
: typename identifier
: are there any difference between thetwo notations? If so, what are they?

avatar
b*n
3
不全对。如果template parameter是一个template class,就一定要用class,
不能用typename。

【在 t****t 的大作中提到】
: in template parameter no difference.
avatar
c*e
4
never heard of this. and i definitely used typename in the case u
described.

【在 b********n 的大作中提到】
: 不全对。如果template parameter是一个template class,就一定要用class,
: 不能用typename。

avatar
t*t
5
hmm, i am not sure on this
template class K> ...
maybe you can not use "typename K" here. but what i meant is, when they can
both be used then they are equivalent [14.1, clause 2]

【在 c********e 的大作中提到】
: never heard of this. and i definitely used typename in the case u
: described.

avatar
p*u
6
C++ templates: the complete guide page 51, K has to be declared by
keyword class, while T can be typename.

can

【在 t****t 的大作中提到】
: hmm, i am not sure on this
: template class K> ...
: maybe you can not use "typename K" here. but what i meant is, when they can
: both be used then they are equivalent [14.1, clause 2]

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。