Use a goto statement in the Argument::is function

This commit is contained in:
Username404 2021-09-23 19:35:35 +02:00
parent 2de8ce3e43
commit 471a588d37
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 3 deletions

View File

@ -37,11 +37,10 @@ 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()) {
auto isValid = [&]() -> bool { return str.starts_with("--" + longVersion + '='); }; if (values.empty()) isValid: return str.starts_with("--" + longVersion + '=');
if (values.empty()) return isValid();
for (const auto& value : values) { for (const auto& value : values) {
if (str.ends_with(value.substr(1, value.size()))) { if (str.ends_with(value.substr(1, value.size()))) {
return isValid(); goto isValid;
} }
} }
} }