What is the difference between 'typedef' and 'using' in C++11?

后端 未结 7 825
误落风尘
误落风尘 2020-11-22 03:32

I know that in C++11 we can now use using to write type alias, like typedefs:

typedef int MyInt;

Is, from what I

7条回答
  •  别那么骄傲
    2020-11-22 03:54

    They are largely the same, except that:

    The alias declaration is compatible with templates, whereas the C style typedef is not.

提交回复
热议问题