C++ vs D aggregates

Dejan Lekic dejan.lekic at gmail.com
Sat Dec 3 11:14:52 PST 2011

I recently stumbled on this thread: http://stackoverflow.com/

The important part is this:

-------- 8< --------- begin ---------
The Standard says in section §8.5.1/1,

An aggregate is an array or a class (clause 9) with no user-declared 
constructors (12.1), no private or protected non-static data members 
(clause 11), no base classes (clause 10), and no virtual functions (10.3).

And then it says in §8.5.1/2 that,

When an aggregate is initialized the initializer can contain an 
initializer-clause consisting of a brace-enclosed, comma-separated list 
of initializer-clauses for the members of the aggregate, written in 
increasing subscript or member order. If the aggregate contains 
subaggregates, this rule applies recursively to the members of the 
-------- >8 --------- end ---------

Do D2 aggregates behave the same, or are there notable differences?

More information about the Digitalmars-d-learn mailing list