设置类型的别名的两种方式:

-使用 typedef

typedef std::string::size_type testType;
testType cursor = 0;
  • 使用类型别名
using testType = std::string::size_type;
testType cursor = 0;

两种方式等价,可以根据喜好使用。

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐