I prefer that all the members marked with myUDA are process in the order thy appear in Foo. This happens automatically when I iterate with through 'getMemberByUDA'.

// Reduced example code
enum myUDA;
struct Foo {
public:
  @myUDA void  bar(float f) { baz = 1 / f; }
  @myUDA float bar() { return 1 / baz; }
  float baz;
}

import std.traits;
string getMemberFuncName(T)(ref T foo) {
  static foreach(member; getSymbolsByUDA!(T, myUDA)) {
    static if(isSomeFunction!member) {

// Error: function `Test.Foo.bar(float f)` is not callable using argument types `()`
      // pragma(msg, member.stringof);

      // Don't want the fully qualified name, just the func name
      pragma(msg, fullyQualifiedName!member);

      // return the name of the first found member function
      //return name;
    }
  }
  return "";
}

void main() {
  Foo foo;
  string name = getMemberFuncName(foo);
}

Reply via email to