c++ Programming Glossary: underlying_type
Can an enum class be converted to the underlying type? http://stackoverflow.com/questions/14589417/can-an-enum-class-be-converted-to-the-underlying-type 11 share improve this question I think you can use std underlying_type to know the underlying type and then use cast #include type_traits.. type and then use cast #include type_traits for std underlying_type typedef std underlying_type my_fields type utype utype a static_cast.. #include type_traits for std underlying_type typedef std underlying_type my_fields type utype utype a static_cast utype my_fields field..
How do I get the fundamental type of an enum? http://stackoverflow.com/questions/7931378/how-do-i-get-the-fundamental-type-of-an-enum improve this question It should be available as std underlying_type DrawBoldMode type . However my compiler GCC 4.6.1 doesn't seem..
Allow for Range-Based For with enum classes? http://stackoverflow.com/questions/8498300/allow-for-range-based-for-with-enum-classes what you want COLOR operator COLOR x return x COLOR std underlying_type COLOR type x 1 COLOR operator COLOR c return c COLOR begin COLOR..
C++11 Fun with initializer lists, arrays, and enumerations http://stackoverflow.com/questions/8606315/c11-fun-with-initializer-lists-arrays-and-enumerations and what I'm going to call the indices trick . typedef std underlying_type eCOLORS type underlying just a type to carry around variadic.. assumes all the enumerators are sequential and needs std underlying_type which is not supported in GCC 4.6 will be in 4.7 but you can..
How to know underlying type of class enum? http://stackoverflow.com/questions/9343329/how-to-know-underlying-type-of-class-enum something like this FooEnum myEnum uint64_t intPointer underlying_typeof myEnum myEnum Is this possible c c 11 share improve this.. c 11 share improve this question You can use this std underlying_type class template to know the underlying type of enum. The doc..
|