Is an array of any type always an aggregate? Is an array of any type always an aggregate? arrays arrays

Is an array of any type always an aggregate?


Yes, A[8] is an aggregate type, even though A is not.

The notion of aggregate is not transitive, unlike some other related notions (such as "trivially copyable").

Loosely speaking, being an aggregate only impacts the type's initialization, and thus it does not need to be transitive. You can say A a[2] = { A('x', true), A(1, 2, 3) }; without needing to put restrictions on the nature of A. By contrast, notions like trivial copyability relate to a class's memory layout and thus by their very nature must be transitive.