Re: D equivalent of the X macro?

2014-05-02 Thread Jacob Carlborg via Digitalmars-d
On 02/05/14 02:22, H. S. Teoh via Digitalmars-d 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 equi

Re: D equivalent of the X macro?

2014-05-01 Thread Steven Schveighoffer via Digitalmars-d
at'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

Re: D equivalent of the X macro?

2014-05-01 Thread Artur Skawina via Digitalmars-d
On 05/02/14 02:22, H. S. Teoh via Digitalmars-d 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

D equivalent of the X macro?

2014-05-01 Thread H. S. Teoh via Digitalmars-d
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 ma