gpt4 book ai didi

c++ - using-style 和 typedef-style 有什么区别?

转载 作者:太空狗 更新时间:2023-10-29 23:51:47 27 4
gpt4 key购买 nike

<分区>

using IntegerType1 = int;
typedef int IntegerType2;

int main()
{
IntegerType1 n1 = 1; // OK
IntegerType2 n2 = 2; // OK
}

我的问题是:

  1. using-style 和 typedef-style 有什么区别?

  2. 既然我们已经有了 typedef 风格,那么让 using 风格成为 C++ 标准的动机是什么?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com