I have an enum class which has 4 different values. A, B, C and D.
I have no control over what the underlying type is.
I have a vector of enums and I want to order it so all A are first. Then all B, Then all C and finally all D.
I can do it with very long if statements. But I wonder if there is an easy idiomatic way to achieve this.
edit: You are misunderstanding what I want. I have an enum class like this:
enum class MyEnum { A = 3, B = 1, C = 4, D = 2};
I have a vector of this enum and I want to order so that A is before B before C before D.
std::sort doesn't help at all here.