Struct initialization syntax

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 17 17:37:07 UTC 2018


On Wed, Jan 17, 2018 at 05:31:03PM +0000, Azi Hassan via Digitalmars-d-learn wrote:
> The D tour for structs uses a syntax similar to that of C++ in order
> to initialize a Person struct : Person p(30, 180). Is this syntax
> supported in D ? Running that part of the code neither works on the
> playground nor on my machine (dmd v2.076.0).

You're probably looking for this syntax:

	auto p = Person(30, 180);


T

-- 
Never step over a puddle, always step around it. Chances are that whatever made it is still dripping.


More information about the Digitalmars-d-learn mailing list