Default struct constructor

Paul paultjeadriaanse at gmail.com
Wed Jan 27 15:00:48 UTC 2021


On Friday, 8 February 2019 at 19:53:16 UTC, psycha0s wrote:
>> In my particular case I need RAII initializing a C library 
>> object. Some of the C constructor functions don't have 
>> arguments. So the only way to do it is my silly hack with 
>> Dummy object. I would probably vote for a change in D spec.
>
> I see. Yeah, I remember I encountered with the need to have a 
> default struct constructor myself earlier, but I couldn't 
> remember the reason. Some of the current D "features" are very 
> inconvenient. Especially the inability to pass an rvalue by a 
> const reference and the forbidden default constructors for 
> structs.

I'd also like to see the possibility for overriding the default 
struct constructor.
I wouldn't say it's absolutely necessary in my case, as I _could_ 
use a class instead, however I believe a struct is more proper in 
my scenario.


More information about the Digitalmars-d mailing list