Use a string mixin? string fun(string name) { return "public static int " ~ name ~ "() { return 0; }"; }
struct S { mixin (fun("fctn1")); } void main() { S s; import std.stdio; writeln(s.fctn1()); }
Philippe Sigaud via Digitalmars-d-learn Fri, 20 Jun 2014 22:53:22 -0700
Use a string mixin? string fun(string name) { return "public static int " ~ name ~ "() { return 0; }"; }
struct S { mixin (fun("fctn1")); } void main() { S s; import std.stdio; writeln(s.fctn1()); }