更新时间:2022-03-25 07:21:08
您需要具有以下签名
template <typename T>
void func(typename Foo<T>::Bar* bar) // Why is this line wrong???
但是,这不是唯一的问题
However, that is not the only problem
func(&foo.bar_);
也必须是
func<int>(&foo.bar_);
这是因为您正在调用模板化函数"func",但是无法推断出其类型.没有它的类型,它将给出一个错误,例如
This is because you are calling the templated function "func" but its type can not be deduced. Without its type, it will give an error such as
no matching function for call to 'func(Foo<int>::Bar*)'