I noticed that in C++ bool is implicitly converted to char. I realize that they're both stored as 1 byte, but they're fundamentally different types. Is there some compiler flag or something I can set to prevent an implicit conversion between the two? char
being automatically converted to bool
makes sense, but not the other way around.
for example, the following is valid:
char test = true;
I'm using Xcode with C++17
bool
fits in achar
but not the other way around. - cigienchar test = strict<char>(true);
will fail to compile. Just need to make thestrict
template class that disallows anything that not the type. - Eljay