Get complete function declaration

Ivan Kazmenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 18 06:53:11 PDT 2017


On Tuesday, 18 July 2017 at 13:35:49 UTC, SrMordred wrote:
> There is a way to get the full function(or any other structure) 
> declaration with traits? Or I will have to mount it with 
> std.traits functions?
>
> eg.
> void add(int x, int y){}
>
> GetFullFunctionDeclaration!add; //return "void add(int x, int 
> y)"

There are several function traits in std.traits (see 
https://dlang.org/phobos/std_traits.html), which can hopefully be 
combined to reconstruct a function declaration.

I don't see a single method which would do what you want out of 
the box.  Perhaps there is none, since different use cases would 
require different small subsets of features, and all the 
orthogonal features are already available.

Ivan Kazmenko.



More information about the Digitalmars-d-learn mailing list