# operator under C implementation in D1

Sam Hu samhu.samhu at gmail.com
Thu Mar 12 19:27:43 PDT 2009

Thank you very much both!!!I really learnt a lot.And write an excise based on your a/m.

module stringDisp;

import samsTools.PromptMessage;
import tango.io.Stdout;

enum Color {Red,Green,Blue,Yellow,Pink,Black}
template Stringize(alias s)
    auto Stringize=s.stringof;

void testEnum()
    Color color=Color.Red;
    char[] colorName=Stringize!(color);
int main(char[][] args)
    auto foo=42;
    char[] s=Stringize!(foo);
    return 0;
I noticed that this will print the variable's type name in string format,say,Enum Color{} Color color=Color.Red... The Stringize!(color) will print INT.What if I want it print "Red" or "Color.Red"?
Thanks and best regards,

More information about the Digitalmars-d-learn mailing list