is there any way to get the maximum value of enumeration constants?
since the enum constants may have explicitly assigned values its not necessarily the last element. Mostly there is a constant called like XXX_cnt but in my case its not. Also the enum may be changed without my notice so just using the last element is error prone.
So is there any way?
No. This is why sometimes you can find explicit definition of max and min in enumeration type:
enum e { zero, one, two, min = zero, max = two};
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