可能重复:
typedef和在C++ 11中使用有什么区别?
以下代码编译并运行.我的问题是"typedef"和"using"方法之间用于重命名模板特化的区别是什么?
template<typename T>
struct myTempl{
T val;
};
int main (int, char const *[])
{
using templ_i = myTempl<int>;
templ_i i;
i.val=4;
typedef myTempl<float> templ_f;
templ_f f;
f.val=5.3;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果没有差异,你更喜欢哪一个?/为什么引入使用... = ...版本?