支持使用负数

This commit is contained in:
2024-06-30 15:23:29 +08:00
parent 5599e5d024
commit 68f377ceda
2 changed files with 17 additions and 7 deletions

View File

@@ -123,8 +123,6 @@ namespace ling {
throw OptionsException("重复提供参数:" + *it);
if (std::next(it) == cmd.end())
throw OptionsException("参数不足!" + *it + " 需要提供参数");
if (std::next(it)->at(0) == '-')
throw OptionsException("参数不足!" + *it + " 需要提供参数");
++it;
opt_str[rules->second.id] = *it;
break;
@@ -133,8 +131,6 @@ namespace ling {
throw OptionsException("重复提供参数:" + *it);
if (std::next(it) == cmd.end())
throw OptionsException("参数不足!" + *it + " 需要提供参数");
if (std::next(it)->at(0) == '-')
throw OptionsException("参数不足!" + *it + " 需要提供参数");
++it;
opt_int[rules->second.id] = toInt64(*it);
break;
@@ -143,8 +139,6 @@ namespace ling {
throw OptionsException("重复提供参数:" + *it);
if (std::next(it) == cmd.end())
throw OptionsException("参数不足!" + *it + " 需要提供参数");
if (std::next(it)->at(0) == '-')
throw OptionsException("参数不足!" + *it + " 需要提供参数");
++it;
opt_double[rules->second.id] = std::stod(*it);
break;