all functions that have a first arg of type T

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 19:57:25 PST 2016


foreach(m; __traits(allMembers, vulkan_input))
{
     static if (m.endsWith("_T"))
     {
         foreach(m2; __traits(allMembers, vulkan_input))
         {
              static if (__traits(isStaticFunction,typeof(m2)))// 
<- what here?
              {
                  enum fn = __traits(getMember,vulkan_input, m2);
                  enum parameters = Parameters!(fn);
                  static if (parameters[0] == m)
                      writeln( m, ":",m2);
              }
         }
     }
}
m2 is a string
I've tried mixin: gives me Error: function 
vulkan_input.VK_MAKE_VERSION (int major, int minor, int patch) is 
not callable using argument types ()
and various combos of typeof and mixin

typeof(m2) is an __error
typeof(mixin(m2)) " T is not an expression". fails for m2 == uint 
etc and m2 == module gives module had no type

Nic


More information about the Digitalmars-d-learn mailing list