I would like to redefine the built-in type bool inside a library's namespaces and classes because they need to work differently but I would like to keep the name bool : ex::bool, ex::false, ex::true. But my compiler doesn't let me do that, I tried something like this :
namespace ex {
typedef uint8_t bool;
const uint8_t false = 0;
}
I also tried prefixing bool and false with ex:: inside the definition to emphasis the fact that it is in ex but it doesn't work. What could I do to have ex::bool ?
What could I do to have
ex::bool?
You can't do anything. bool and false are hardwired with meaning by the language specification and are intrinsic keywords. You can't change their meaning any more than you can change the meaning of 0, if or while.
Choosing different names (such as Bool and False) is your only option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With