#include #include enum class Level : int { High, Medium, Low }; std::istream &operator>>(std::istream &in, Level &level) { int i; in >> i; level = static_cast(i); return in; } std::ostream &operator<<(std::ostream &in, const Level &level) { return in << static_cast(level); } int main(int argc, char **argv) { CLI::App app; Level level; app.add_option("-l,--level", level, "Level settings") ->check(CLI::IsMember({Level::High, Level::Medium, Level::Low})) ->type_name("enum/Level in {High=0, Medium=1, Low=2}"); CLI11_PARSE(app, argc, argv); return 0; }