> Oh I see you're using std::underlying_type. That should provide you with some
> kind of integer and allow you to remove the casts. If it doesn't then you can
> still change value_type to "unsigned int" and remove the casts.
The casts inside Flags iteself are needed because it has to support both scoped and non-scoped enums. For scoped those are absolutely necessary and behave as intended. With c++11 enums can be forward declared since the standard now defines the underlying type to default to int32_t (iirc) - and allows manual specification in forward declaration (only for scoped..). Additionally the trait was added to resolve manually specified underlying types. I am sorry there is nothing to fix there.... just to add but more on that on monday i guess.
> Oh I see you're using std::underlying _type. That should provide you with some
> kind of integer and allow you to remove the casts. If it doesn't then you can
> still change value_type to "unsigned int" and remove the casts.
The casts inside Flags iteself are needed because it has to support both scoped and non-scoped enums. For scoped those are absolutely necessary and behave as intended. With c++11 enums can be forward declared since the standard now defines the underlying type to default to int32_t (iirc) - and allows manual specification in forward declaration (only for scoped..). Additionally the trait was added to resolve manually specified underlying types. I am sorry there is nothing to fix there.... just to add but more on that on monday i guess.