Generate toString() method at compile time
    Adam D. Ruppe 
    destructionator at gmail.com
       
    Wed Mar 26 08:10:29 PDT 2014
    
    
  
On Wednesday, 26 March 2014 at 15:01:35 UTC, Ary Borenszweig 
wrote:
> A small question: tupleof seems to return a tuple of values.
Most accurately, it returns a tuple of variables (it is a bit 
magical). So
struct A { int a; string b; }
the tupleof there is int a; string b - variables with different 
types and different names. The stringof works as if you said 
A.a.stringof - it fetches the name of the variable.
The slice I did on it cuts off the "this." from the full name, 
leaving just the name.
Value to string is done with the to!string function, .stringof 
always works at compile time.
    
    
More information about the Digitalmars-d-learn
mailing list