While defining a network-message struct:
- Want to hold the Op field as an Enum (so to limit the allowed values).
- Need to keep all fields as unsigned, and the Op specifically to be uint32_t.
Is there a way to combine these requirements? something like: typedef enum Op : uint32_t {save = 100, retrieve = 101, delete = 200};
"100" "101" "200
Well, I don't quite understand what these strings mean? Your question is not very clear to me.
It sounds like what you want is
enum class
(Scoped enumerations).Yes.
Yes.
You should name these enumerators something meaningful, rather than the same as the value.
According to your edited post: