It is actually already possible to store meta data in classinfos.

---
import std.stdio;

class A {
  int a;
  float b;
}

mixin template register(T) if(is(T == class)) {
  static this() {
T.classinfo.m_offTi = [OffsetTypeInfo(0, typeid(int)), OffsetTypeInfo(4, typeid(float))];
  }
}

mixin register!A;

void main() {
  foreach(offTi; A.classinfo.offTi())
    writeln(offTi.offset, offTi.ti);
}
---

The compiler doesn't initialize the m_offTi array. But classinfos are in the initialized data section, at least for me, so you can write to them.

martin

Reply via email to