template void f(vector::iterator){} this can not compile because of vector::iterator in the parameter list. Why this parameter is not allowed here? Thanks.
【在 r*******y 的大作中提到】 : template void f(vector::iterator){} : this can not compile because of vector::iterator in the parameter : list. Why this parameter is not allowed here? Thanks.
r*y
8 楼
cool we have to tell the compiler that vector::iterator is a typename Thanks.
why the compiler cannot deduce it is a typename by itself? What is the ambiguity there?
【在 r*******y 的大作中提到】 : cool : we have to tell the compiler that vector::iterator is a typename : Thanks.
t*t
10 楼
given type T, compiler can deduce. but when T is unknown, it can not.
【在 l*********s 的大作中提到】 : why the compiler cannot deduce it is a typename by itself? What is the : ambiguity there?
l*s
11 楼
Got it, thank you!
【在 t****t 的大作中提到】 : given type T, compiler can deduce. but when T is unknown, it can not.
S*s
12 楼
with typename, it can. without typename, it won't be taken as something else. so, why typename here is a must? should they better make the typemane here optional?
【在 t****t 的大作中提到】 : given type T, compiler can deduce. but when T is unknown, it can not.
t*t
13 楼
without keyword typename, by default it is member variable. if it is not member variable, it is ill-formed.
【在 S*******s 的大作中提到】 : with typename, it can. : without typename, it won't be taken as something else. : so, why typename here is a must? should they better make the typemane here : optional?