聚合数据类型
称为 aggregates(聚合物)
聚合类型包括: - array type - class type (typically, struct or union), that has - no private or protected direct (since C++17)non-static data members - no user-declared constructors(until C++11) - no user-provided, inherited, or explicit constructors (since C++11) (until C++20) - no user-declared or inherited constructors(since C++20) - no virtual, private, or protected (since C++17) base classes - no virtual member functions - no default member initializers (since C++11) (until C++14)
聚合类型中元素的特点 - for an array, the array elements in increasing subscript order, or - for a class, the non-static data members that are not anonymous bit-fields, in declaration order.(until C++17) - for a class, the direct base classes in declaration order, followed by the direct non-static data members that are neither anonymous bit-fields nor members of an anonymous union, in declaration order.(since C++17)
C++ 中的聚合数据类型必须满足如下条件: