Please support shorter constructor init

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jul 10 08:57:35 UTC 2023


On Saturday, 8 July 2023 at 08:35:12 UTC, FeepingCreature wrote:
> For simple code, you can use my boilerplate library 
> https://code.dlang.org/packages/boilerplate

And for really simple cases you can just do:

```D
class C {
     int x;
     string y;
     float z;

     this(typeof(C.tupleof) args) {
         this.tupleof = args;
     }
}
void main() {
     auto c = new C(1, "foo", 1.0);
}
```

But I guess `boilerplate` supports more advanced features.


More information about the Digitalmars-d mailing list