c++ 模板
作者:互联网
1.typename 在什么时候用
C++中typename的用法 - 腾讯云开发者社区-腾讯云 (tencent.com)
大意就是:在不添加typename 会产生歧义的时候就得加typename,否则不用添加typename
或者要声明一个由模板参数控制得类型的时候要添加typename
例子
template<typename T> struct MyType{ using iterator = typename std::vector<T>::iterator; }; template<typename T> using Iter = typename MyType<T>::iterator; template <typename U> auto Max(U& x,U& y){ return x>y ? x:y; }
标签:iterator,c++,typename,添加,template,MyType,using,模板 来源: https://www.cnblogs.com/dbnn/p/16478028.html