resource structs and default constuction
Erik Smith via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 12:13:44 PDT 2015
> If you want to force that a constructor be called rather than
> using the init value, then you need to make the init value
> unusable by @disabling this(). Then the caller _has_ to
> explicitly call a constructor or factory function. Regardless,
> if you want a constructor that takes no arguments for a struct,
> you need a factory function, since you can't have struct
> constructors with no parameters.
Good to know, but disabling this() also prevents the object from
being a struct member, which is probably too restrictive.
RefCounted wouldn't be workable with this, for example.
I could still use feedback on whether the variadic create is
problem free.
erik
More information about the Digitalmars-d
mailing list