Hi Guys,

Is there an easy way to check if the value of string passed to a template is available at compile time?

Here is a cut down example of that I'm doing:

```
string[] escapeCTFE(Args...)(){

    static foreach (arg; Args){
        static if(__traits(compiles, ###WHATDOIPUTHERE###)){
            pragma(msg, "Do work on string: ", arg);
        }else{
pragma(msg, __traits(identifier, arg), " can only be read at runtime");
        }
    }

}

void main(){

    string a = "a";
    static string b = "b";
    enum string c = "c";
    immutable string d = "d";
    const string e = "e";

    enum escape_as_much_as_possible = escapeCTFE!(a,b,c,d,e,"f");
}

```

I know for ints I can use __traits(compiles, int[arg]) but I'm not sure about strings.

I believe only a and b should be hidden from pragma right?

Thanks,
David.

Reply via email to