alias somelongsignature = int(in int x); int examplefunc0(in int x){ return x * 2; } somelongsignature testfunc0 = examplefunc1; somelongsignature testfunc1 = somelongsignature {return x + 3}; public void main(){ import std.stdio; writeln(testfunc0(5)); // Should output 10 writeln(testfunc1(5)); // Should output 8 } Thanks!
Using a macro for a function signature
pineapple via Digitalmars-d-learn Tue, 05 Apr 2016 04:42:29 -0700
If I have a common function signature I'm using throughout my
code, and I feel like there should be a way to condense it using
a macro. The intuitive method isn't working, but this seems like
something D would be able to do. What've I got wrong in this
example?
- Using a macro for a function signature pineapple via Digitalmars-d-learn
- Re: Using a macro for a function s... pineapple via Digitalmars-d-learn
- Re: Using a macro for a function s... Anonymouse via Digitalmars-d-learn
- Re: Using a macro for a functi... pineapple via Digitalmars-d-learn
- Re: Using a macro for a function s... ag0aep6g via Digitalmars-d-learn