isCompileTimeValue

Indicates wether something is a value known at compile time.

  1. template isCompileTimeValue(alias V, T...)
    template isCompileTimeValue (
    T...
    ) if (
    T.length == 0 ||
    (
    T.length == 1 &&
    is(T[0])
    )
    ) {
    enum isKnown;
    enum isCompileTimeValue;
    enum isCompileTimeValue;
    }
  2. template isCompileTimeValue(V, T...)
  3. template isStringLiteral(V)

Parameters

V

The value to test.

T

Optional, the expected value type.

Examples

1 string a;
2 enum b = "0";
3 enum c = 0;
4 static assert(!isCompileTimeValue!a);
5 static assert(isCompileTimeValue!b);
6 static assert(isCompileTimeValue!c);
7 static assert(isCompileTimeValue!(b,string));
8 static assert(isCompileTimeValue!(c,int));
9 static assert(!isCompileTimeValue!(c,char));
10 static assert(!isCompileTimeValue!(char));
1 string a;
2 enum b = "0";
3 enum c = 0;
4 static assert(!isStringLiteral!a);
5 static assert(isStringLiteral!b);
6 static assert(!isStringLiteral!c);
7 static assert(!isStringLiteral!int);

Meta