Would love to override default ctor of struct

Basile B. b2.temp at gmx.com
Sat Jan 19 10:22:11 UTC 2019


On Saturday, 19 January 2019 at 10:18:34 UTC, Alex wrote:
> On Saturday, 19 January 2019 at 10:05:22 UTC, Dru wrote:
>> What is the idea behind why we can't define default ctor for 
>> structs?
>>
>> In current situation I need to "@disable this()"
>> then define a constructor with dummy arguments  (because my 
>> constructor does not need arguments)
>>
>> It is a big pain on syntax
>
> If your constructor doesn't need any arguments, what is the 
> reason you can't define default values to your members?

I see your point but...

1. default member values (via initializer) are more like a shared 
this().
2. not everything can be set using member initializer because of 
CTFE limitations.


More information about the Digitalmars-d mailing list