On Thu, 01 May 2014 20:22:11 -0400, H. S. Teoh via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
I was reading this article of Walter's:
http://www.drdobbs.com/cpp/the-x-macro/228700289
Which is a neat trick that I wish I'd known back when I was writing
C/C++. But the thought crossed my mind: what's the D equivalent of the X
macro, since D doesn't have macros? Any ideas?
Tuples immediately come to mind.
Then a mixin to extract the appropriate tuple indexes.
The only issue to overcome is that the mixin has to define the entire
structure, whereas in C, you can have the macro only define the data part,
not the enclosing structure.
-Steve