It's all use-case, I suppose. Larger programs can afford more refined solutions.
To say using uint8_t as a bool is bad because it can break when making templates is to say wood beams are bad because they will buckle under a skyscraper.
I'm not completely sure that in some cases there wouldn't be undefined behaviour, but even if it fails to compile the error will likely be horrible and not easily understandable.
Using uint_8 isn't bad, but rather it's not an option as a replacement if you're the one writing the templated code. Partually because you don't know that bool was actually the intent when you get given a uint_8, but more importantly because in every single function that templates on T and uses vector<T>, you have to write a distinct version of the function that special-cases vector<bool> in case your users instantiate the template with a bool, which should be very reasonable and users should want to do by default, because bools are a useful datatype.
View all comments
Show parent comment
15
u/ImpulsiveBloop 11d ago
It's all use-case, I suppose. Larger programs can afford more refined solutions.
To say using uint8_t as a bool is bad because it can break when making templates is to say wood beams are bad because they will buckle under a skyscraper.