How to get BaseEnumType?

wobbles via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 31 01:12:02 PDT 2015


On Monday, 31 August 2015 at 08:10:35 UTC, wobbles wrote:
> On Monday, 31 August 2015 at 07:55:53 UTC, drug wrote:
>
> import std.stdio;
> import std.traits;
> void main(){
>         static if(isSomeString!Foo){
>                 writefln("String: %s", Foo.A);
>         }
>         static if(isScalarType!Bar){
>                 writefln("Integer: %s", Bar.A);
>         }
>         static if(isSomeString!Bar){
>                 writefln("String: %s", Foo.A); // wont print // 
> Bar.A
>         }
>         static if(isScalarType!Foo){
>                 writefln("Integer: %s", Bar.A); // wont print 
> // Foo.A
>         }
> }
>
> enum Foo { A="a", B = "b" }
> enum Bar { A=1, B=2 }

My copy paste got the better of me. The print messages in the 
last two static ifs shoudl be Bar.A and Foo.A respectively :)


More information about the Digitalmars-d-learn mailing list