On 31.08.2015 11:10, wobbles wrote:

In std.traits there is the required isX funcitons.

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
         }
         static if(isScalarType!Foo){
                 writefln("Integer: %s", Bar.A); // wont print
         }
}

enum Foo { A="a", B = "b" }
enum Bar { A=1, B=2 }

Thank you. But is there a way to check against not predefined type?

Reply via email to