Can't print enum values
Andrey
saasecondbox at yandex.ru
Thu Aug 30 10:41:58 UTC 2018
Hello,
This code doesn't print enum values:
>import std.meta;
>import std.traits;
>import std.stdio;
>
>enum MyEnum : string
>{
> First = "F_i_r_s_t",
> Second = "S_e_c_o_n_d"
>}
>
>alias QW(alias arg) =
>Alias!(cast(OriginalType!(typeof(arg)))arg);
>
>void print(T...)(T args)
>{
> writeln(cast(OriginalType!(typeof(args[0])))args[0]); //
> Works...
> writeln(QW!(args[0])); //
> Doesn't work... MUST!
>
> writeln(staticMap!(QW, args)); //
> Doesn't work... MUST!
>}
>
>void main()
>{
> bool runTimeBool = true;
> print(MyEnum.First, 7, runTimeBool, MyEnum.Second);
>}
Must print "F_i_r_s_t" and "S_e_c_o_n_d", not just "First" and
"Second".
More information about the Digitalmars-d-learn
mailing list