Using a struct as a wrapper for an extern(C) opaque type, no default constructor, what do?

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 16 22:28:44 PST 2015


On Thursday, 17 December 2015 at 06:04:14 UTC, Jeremy DeHaan 
wrote:
> And I guess what I was talking about before is that using a 
> factory method feels klunky to me. If the things I am wrapping 
> had been written in D they could use default initialization, so 
> it feels wrong to do otherwise. I also just don't really like 
> factory methods. They feel like a workaround that the end user 
> has to deal with. But that's just me.

If the type you're wrapping would still be accessed through a 
reference type, then that reference type would have exactly the 
same situation. But yeah, it would allow you to make it a value 
type.



More information about the Digitalmars-d-learn mailing list