How to check at compile time if Default Constructor for a class exists?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 1 07:48:51 PST 2016


On Friday, 1 January 2016 at 15:25:32 UTC, Bottled Gin wrote:
> When I try using TypeInfo_Class.defaultConstructor during 
> compile time, I get:


You might be able to just do `static if(__traits(compiles, new 
YourClass()))` and if it returns true then figure it does.


More information about the Digitalmars-d mailing list