Pointer to variables in D
Victor Vicente de Carvalho
victor.v.carvalho at gmail.com
Wed Apr 25 19:43:33 PDT 2012
Hi there,
In c++ one can access a pointer to a class/struct variable using
this semantic:
struct C {
int x;
};
int C::* ptr = &C::x;
C foo;
foo.*ptr = 10;
assert(foo.x == 10);
It is possible to do something like that on D? I've searched
through the forum & documentation but didn't found anything.
Also, the reason of this is that I'm studying a way to map a POD
structure based from a dynamic, data-driven structure. Something
like "get a JSON and map it to a structure automagically". There
is a nicer way to do that in D?
More information about the Digitalmars-d-learn
mailing list