Use any_of instead of a range-based loop in the Argument::is function

This commit is contained in:
Username404-59 2021-10-05 08:45:38 +02:00
parent 58f2d9cba7
commit 24d934caf2
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 6 deletions

View File

@ -37,12 +37,9 @@ public:
protected: protected:
bool is(string_view str) override { bool is(string_view str) override {
if (str.find_last_of('=') != string_view::npos && !str.empty()) { if (str.find_last_of('=') != string_view::npos && !str.empty()) {
if (values.empty()) isValid: return str.starts_with("--" + longVersion + '='); return (((values.empty()) ? str.starts_with("--" + longVersion + '=') : any_of(values.begin(), values.end(), [&str](const auto& value){
for (const auto& value: values) { return str.ends_with(value.substr(1, value.size()));
if (str.ends_with(value.substr(1, value.size()))) { })));
goto isValid;
}
}
} }
return false; return false;
} }