这个Typedef试图做的事情以及如何使用

What this typedef is trying to do and How to use?

本文关键字:何使用 Typedef 这个      更新时间:2023-10-16
  1. struct boolean_struct { int member; } typedef int boolean_struct::* boolean_type;

  2. typedef char(&yes)[1];

请说明这些类型的在做什么。我真的很想理解它们。

他们为某些文本创建别名: typedef int kappa; kappa a; // the type of a is int

typedef更好的是using别名,因为它更可读,其含义是相同的。 using kappa = int; kappa a; // the type of a is int