I tried the following code to see whether CLI11 supports the use of enumerations in add_set
and got a series of errors. Is the code wrong is support for enumerations planned/not going to be added?
#include <iostream>
#include <string>
#include <CLI/CLI.hpp>
enum Level : std::int32_t
{
High,
Medium,
Low
};
int main(int argc, char* argv[])
{
CLI::App app{"App description"};
try
{
Level level;
app.add_set("-l,--level", level, {Level::High, Level::Medium, Level::Low}, "Level settings");
app.parse(argc, argv);
}
catch (CLI::Error const& e)
{
app.exit(e);
}
return EXIT_SUCCESS;
}
1>f:\github\cli11\include\cli\typetools.hpp(108): error C2440: '=': cannot convert from 'std::string' to 'Level'
1>f:\github\cli11\include\cli\typetools.hpp(108): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>f:\github\cli11\include\cli\app.hpp(326): note: see reference to function template instantiation 'bool CLI::detail::lexical_cast<T,0>(std::string,T &)' being compiled
1> with
1> [
1> T=Level
1> ]
1>f:\code\visual studio 2017\projects\cmdapp\cmdapp\main.cpp(20): note: see reference to function template instantiation 'CLI::Option *CLI::App::add_set<Level>(std::string,T &,std::set<Level,std::less<_Kty>,std::allocator<_Kty>>,std::string,bool)' being compiled
1> with
1> [
1> T=Level,
1> _Kty=Level
1> ]
1>Done building project "cmdapp.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========