I got used to writing this idiom:
assert(!"Something went wrong");
But now -Wconversion has been enabled in the project, and this code no longer compiles:
error: implicit conversion turns string literal into bool
I understand that if I cast it explicitly, the error will go away, but it is too cumbersome:
assert(!static_cast<bool>("Something went wrong"));
Is there a more elegant solution to this?
>Solution :
And my options, shorter than the other earlier answered:
assert(!"something went wrong"[0]);
assert(!*"something went wrong");