enum MyEnum
{
SOME_NAME = 2147483648;
};
...
enum_<MyEnum>("MyEnum")
.value("SOME_NAME", SOME_NAME)
;
While this compile fine, it crashes on initialization cause enum_ is casting values as "long" which is limited to 2147483647
. I'd need them to be unsigned long. Is there any way to do that without having to create an entire enum wrapper?
Thanks!
C++ allows you to implicitly cast an enum
to an int
, not an unsigned int
. You're capped to INT_MAX
as the maximum value. Furthermore, you have to cast an int
(or an unsigned int
that becomes sign-converted) to convert it back to an enum
.
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