"putting an assert at the end doesn't seems correct" Why not? Also if you only have two states, it sounds like a job for
bool
, not a enum, then you won't have this problem. Also I recommend not adding a default:
branch to enable the warning for unhandled enum values (on GCC & Clang), and handle invalid values below the switch instead.