struct construction (how?)

bearophile bearophileHUGS at lycos.com
Mon Dec 28 12:53:27 PST 2009


Ali Çehreli:

>  >> auto s = S(1, 2);
> 
> Doesn't work for structs that have opCall (or maybe an opCall with 
> matching parameters to that use).

Try:
static S opCall(int x, int y) { this.x = x; this.y = y; }


> I think the {} should still default initialize the 
> remaining members (like C and C++).

That's what it does.


> One issue remains, which prompted me to open this thread in the first place:

Other people that understand you better than me will have to answer you.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list