I wonder there is the way as I said in the title. For instance,

in C,
#define indexInvalidException Exception("The index is invalid")

/* Do something with the macro here */
if (false)
  indexInvalidException;

This is allowed.
But I want to do the exact same thing in D. I have already tried some expressions with alias? but it doesn't work.

alias indexInvalidException = Exception("The index is invalid");

/* Use the alias in somewhere */
if (false)
  throw new indexInvalidException;

Would you help me, please?

Reply via email to