我知道在C++ 11中我们现在可以using用来写类型别名,比如typedefs:
typedef int MyInt;
Run Code Online (Sandbox Code Playgroud)
从我的理解,相当于:
using MyInt = int;
Run Code Online (Sandbox Code Playgroud)
这种新语法来自于努力表达" template typedef":
template< class T > using MyType = AnotherType< T, MyAllocatorType >;
Run Code Online (Sandbox Code Playgroud)
但是,对于前两个非模板示例,标准中是否还有其他细微差别?例如,typedefs以"弱"方式进行别名.也就是说,它不会创建新类型,而只会创建新名称(这些名称之间隐含的转换).
它是否与using生成新类型相同或是否生成新类型?有什么不同吗?