mardi 31 juillet 2018

how to tell if a enum class value is in a specified range of enum class in a more effective way?

enum class color {
    red,
    black,
    white,
    yellow,
    green,
    blue,
};
color c;
if(c == color::red && c == color::black || c == color::green -etc.)

The last statement is too fussy,is there any better way to do it like if(c in(color::red,color::black,color::green))?

Aucun commentaire:

Enregistrer un commentaire