Default struct constructor

Victor Porton porton at narod.ru
Fri Feb 8 19:24:00 UTC 2019


On Friday, 8 February 2019 at 19:20:59 UTC, psycha0s wrote:
> What kind of problems a default struct constructor could solve? 
> If you want to use RAII, you need to pass the resource as an 
> argument. If you want to set some initial state, you can do it 
> by assigning values to the struct members directly.

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.


More information about the Digitalmars-d mailing list