On Friday, 28 October 2016 at 03:33:33 UTC, Basile B. wrote:
On Thursday, 27 October 2016 at 14:04:23 UTC, Gianni Pisetta wrote:
So i searched for a metod to check if an alias is a literal value, but found nothing. Anyone have any clue on how can be done?

Thanks,
Gianni Pisetta

Hello, I think the correct isStringLiteral would be:

import
    std.meta;

template isStringLiteral(alias V)
{
    enum isCompileTime = is(typeof((){enum a = V;}));
    enum isString = is(typeof(V) == string);
    enum isStringLiteral = isCompileTime && isString;
}

[...]

In addition a fallback for the types must be added:

template isStringLiteral(V){enum isStringLiteral = false;}

Reply via email to