Use any_of instead of a range-based loop in the Argument::is function
This commit is contained in:
parent
58f2d9cba7
commit
24d934caf2
|
@ -37,12 +37,9 @@ public:
|
|||
protected:
|
||||
bool is(string_view str) override {
|
||||
if (str.find_last_of('=') != string_view::npos && !str.empty()) {
|
||||
if (values.empty()) isValid: return str.starts_with("--" + longVersion + '=');
|
||||
for (const auto& value: values) {
|
||||
if (str.ends_with(value.substr(1, value.size()))) {
|
||||
goto isValid;
|
||||
}
|
||||
}
|
||||
return (((values.empty()) ? str.starts_with("--" + longVersion + '=') : any_of(values.begin(), values.end(), [&str](const auto& value){
|
||||
return str.ends_with(value.substr(1, value.size()));
|
||||
})));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue