Daniel Keep:
> enum defines a "manifest constant." In other words, it defines a
> constant that does NOT consume any storage anywhere in the program: it
> exists only at compile-time.
For the original poster: this is true in D2+ only, not in D1.
Bye,
bearophile
Thank you very much Daniel!
For q1:clear;
For q2: You are right,it should be "~" other than "-" since it is not very
clear from the vidio of Walter's metaprogramming In D:
http://www.vimeo.com/4333802
Thanks again.
Sam
Sam Hu wrote:
> Hello everybody!
>
> Convert integral value to string literal:
>
> template myToString(ulong n,
> string suffix=n>uint.max?"UL":"U"
> {
> static if (n<10)
> enum myToString=cast(char)(n+'0')-suffix; //q1
> else
> enum myToString=.myToString!(n/10,"
Hello everybody!
Convert integral value to string literal:
template myToString(ulong n,
string suffix=n>uint.max?"UL":"U"
{
static if (n<10)
enum myToString=cast(char)(n+'0')-suffix; //q1
else
enum myToString=.myToString!(n/10,"")-
.myToString!(n%10,