I can identify the templates in a module:

  module modtemp;

  import std.stdio;
  import std.traits;

  void foo(T)(T x) {}

  void main()
  {
    foreach (m; __traits(allMembers, modtemp)) {
      if (__traits(isTemplate, mixin(m))) {
        mixin("alias F = " ~ m ~ ";");
        writeln(m);
      }
    }
  }
  // output:
  // foo

I'd like to go further: find the template arguments and the function arguments and return types. Looking at __traits and std.traits, it doesn't seem feasible, but maybe I overlooked something?



Reply via email to