I figured out a way to get the offsetof any member statically:
class A {
char a;
int b;
char c;
}
void main()
{
int[A.init.a.offsetof] x;
}
Unfortunately, I can't figure a way to get the class' size statically.
This doesn't work:
int[A.classinfo.init.length] x;
Any way to fetch the size of A?
Andrei

I figured out a way to get the offsetof any member statically:
class A {
char a;
int b;
char c;
}
void main()
{
int[A.init.a.offsetof] x;
}
Unfortunately, I can't figure a way to get the class' size statically.
This doesn't work:
int[A.classinfo.init.length] x;
Any way to fetch the size of A?
Andrei

This question was on .learn, from where the answer (by Jarret) was:
__traits(classInstanceSize, Class)

I figured out a way to get the offsetof any member statically:
class A {
char a;
int b;
char c;
}
void main()
{
int[A.init.a.offsetof] x;
}
Unfortunately, I can't figure a way to get the class' size statically.
This doesn't work:
int[A.classinfo.init.length] x;
Any way to fetch the size of A?
Andrei

This question was on .learn, from where the answer (by Jarret) was:
__traits(classInstanceSize, Class)

I figured out a way to get the offsetof any member statically:
class A {
char a;
int b;
char c;
}
void main()
{
int[A.init.a.offsetof] x;
}
Unfortunately, I can't figure a way to get the class' size statically.
This doesn't work:
int[A.classinfo.init.length] x;
Any way to fetch the size of A?
Andrei

I figured out a way to get the offsetof any member statically:
class A {
char a;
int b;
char c;
}
void main()
{
int[A.init.a.offsetof] x;
}
Unfortunately, I can't figure a way to get the class' size statically.
This doesn't work:
int[A.classinfo.init.length] x;
Any way to fetch the size of A?