struct template help

Danyal Zia via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 12 12:47:13 PDT 2014


On Saturday, 12 July 2014 at 19:42:13 UTC, Ali Çehreli wrote:
> Actually, that works too but members must be initialized from 
> the beginning. The trailing ones are left with .init values:
>
> struct S
> {
>     int i;
>     string s;
> }
>
> void main()
> {
>     auto s = new S(42);
>     static assert(is (typeof(s) == S*));
> }
>
> Ali

Ah, right. I still has C++ background in my veins I guess :)



More information about the Digitalmars-d-learn mailing list