I need to check if a generic variable (of type T) has its default value at compile time, so I wrote:
static_assert(var == T{}, "var cannot be initialized by using its default value");
However, the compiler shows me this error:
expression did not evaluate to a constant
May you help me to fix this? How should I formulate that condition so that it's accepted by static_assert?
Aucun commentaire:
Enregistrer un commentaire