On 2011-08-25 06:30, Martin Nowak wrote:
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

Seems to be very unsafe to rely on m_offTi in ClassInfo.

--
/Jacob Carlborg

Reply via email to