alias template
type alias
就是类型重命名,类型重命名有两种 typedef和using
typedef int ElemType;
using ElemType = int;
typedef和using的区别
在这里,typedef和using都可以用来将int命名为ElemType,实现的功能是完全一样的。
但是,typedef不能和template一起使用。
alias template
template <class T>
using Vec = std::vector<T, std::allocator<T>>;
int main()
{
Vec<int>v;
return 0;
}
使用typeedf不行