Templates and stringof...

Era Scarecrow rtcvb32 at yahoo.com
Fri Aug 3 14:33:34 PDT 2012


On Friday, 3 August 2012 at 21:19:08 UTC, David Nadlinger wrote:
> On Friday, 3 August 2012 at 21:02:22 UTC, Era Scarecrow wrote:
>> Now, how do I get the template's stringof to print out 
>> 'i_num.i' and not 'i'?
>
> You don't. Using .stringof in conjunction with string mixins is 
> The Wrong Thing (tm) in virtually all cases.
>
> What do you want to achieve? Why can't you pass a string 
> instead?

  Because a string doesn't hold it's type information for size 
checking.

  int = 4 bytes or 32 bits
  string = ????

  It also checks for unsuitable types like structs and floats; 
can't do that with strings.


More information about the Digitalmars-d-learn mailing list