French software engineer with 15 year experience on 3D data visualisation and processing. Lots of C++, and switch to Unity recently.
I like when it run fast 😉
Hey, I always found bitwise enums dangerous because they were based on low level consideration, and thus often end up having a Pandora box in your code. I've seen code casting those enums to int to do arithmetics, or adding an intermediate "isHybride = 3" after a few years of entropy, making it half an enum, half a bitflags 😱
But using enum class and redefining operators like you did make things much more robust. Thanks for sharing !
Hey, I always found bitwise enums dangerous because they were based on low level consideration, and thus often end up having a Pandora box in your code. I've seen code casting those enums to int to do arithmetics, or adding an intermediate "isHybride = 3" after a few years of entropy, making it half an enum, half a bitflags 😱
But using enum class and redefining operators like you did make things much more robust. Thanks for sharing !
Thanks for your comment, Thibaut! I'm glad if you found this article useful!
"isHybride = 3"... oh wow :D That's something I'd not expect to see, but yeah, it might happen...
Have a look at this article, Visual Studio might catch such ugly things!