I want to create a mixin template such that:

mixin template ArgNull(alias arg, string name)
{
    if(arg is null)
        throw new Exception(name~" cannot be null.");
}

But is there a way to do that with only one template argument. And then use it like:

string text = null;
mixin ArgNull!(text);

And the above mixin to make:

if(text is null)
    throw new Exception("text cannot be null.");

Reply via email to