Getting constructor's metadata

Christopher Wright dhasenan at
Thu Oct 8 15:46:08 PDT 2009

Max Samukha wrote:
> Is it possible to get types or aliases of all constructors of a class
> in D2?


__traits has some random functionality in this regard. It has a command 
getVirtualFunctions which only returns virtual overloads. By "virtual", 
we mean "appears in vtbl". So any non-private, non-static overload will 
show up.

Constructors do not appear in any object vtbl. It would be kind of odd 
if they did.

There's a patch to add getOverloads to __traits. It would do what you 
want. But I doubt it works on DMD >2.020.

More information about the Digitalmars-d-learn mailing list