3 ms·
I’m not sure I follow entirely, but an explicit operator bool will only auto-convert in contexts where it makes sense, and not e.g. in arithemtic expressions.
by nemetroid 2y ago
I’m not sure I follow entirely, but an explicit operator bool will only auto-convert in contexts where it makes sense, and not e.g. in arithemtic expressions.
https://stackoverflow.com/questions/39995573/when-can-i-use-explicit-operator-bool-without-a-cast https://stackoverflow.com/questions/39995573/when-can-i-use-...
- advael 2y agoExplicit keyword seems reasonable too, I just like !! more than the verbosity of casting tbh. Totally aesthetic preference