C ++ 20中的指定初始值设定项
我对c ++ 20功能之一(指定的初始化程序)有疑问(有关此功能的更多信息,请点击此处) #include <iostream> constexpr unsigned DEFAULT_SALARY {10000}; struct Person { std::string name{}; std::string surname{}; unsigned age{}; }; struct Employee : Person { unsigned salary{DEFAULT_SALARY}; }; int main() { std::cout << std::boolalpha << std::is_aggregate_v<Person> << '\n'; // true is printed std::cout << std::boolalpha << std::is_aggregate_v<Employee> << '\n'; // true …