Print out the name of a type

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jul 4 07:46:23 PDT 2013


Suppose I've got a function that is conditional on a type:

    void foo(T)(/* input vars */) { ... }

How could I print out using writeln the name of that type?  So that if I call

    foo!double(...);

... I would see:

    Today, Michael, I'm going to be a double!

... whereas if I give it,

    foo!uint(...);

I'd see

    Today, Michael, I'm going to be a uint!

and so on.  Ideally this should also work for complex data types such as
structs, classes, etc.


More information about the Digitalmars-d-learn mailing list