I have a pretty concrete question; Is there any difference in the performance when declaring an enum outside a class and when declaring an enum within the class? Thanks!
No, there is no performance difference.
Any enum or enum class declared within class scope has it's name bounded to the class' name (in the sense that the name of a class is also a namespace); and access checking is performed for its use.
The only real difference here is the access checking, otherwise, the namespace point, is not an issue, because every name in C++ is decared within some namespace (whether global or not).
There is no performance implication.
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