How get struct value by member name string ?

John Xu 728308756 at qq.com
Fri Jun 2 03:04:05 UTC 2023


A correction:

      string getTMember(T t, string columnName) {
          foreach(member; __traits(allMembers, T)){
              if (member == columnName) {
                  return __traits(getMember, t, member).to!string;
              }
          }
          return "";
      }




More information about the Digitalmars-d-learn mailing list