Yeah, D feels like that to me too, sometimes. Anyways, for your question -
would using the struct name be good enough? They're easy to get hold of
and usable in switch statements.
If not, how about this:
import std.typetuple;
struct TypeEnum( T... ) {
static pure nothrow @property
Hello!
I have some structs
struct A { int a; }
struct B { int b, c; }
and I'd like to be able to enumerate them (preferrably as integers) based on
their names. I've no idea how this would look, but
some pseudo code that would use this feature:
// pseudo
int type = stream.read!int();
On Tue, 03 Jan 2012 16:35:29 +0100, Heywood Floyd soul...@gmail.com
wrote:
Hello!
I have some structs
struct A { int a; }
struct B { int b, c; }
and I'd like to be able to enumerate them (preferrably as integers)
based on their names. I've no idea how this would look, but
some