use find_if

This commit is contained in:
Paul Fd 2020-03-05 16:59:35 +01:00
parent 7532291545
commit 70bc12f484

View file

@ -45,12 +45,8 @@ std::unique_ptr<Effect> EffectFactory::makeEffect(absl::Span<const Opcode> membe
absl::string_view type = opcode->value; absl::string_view type = opcode->value;
auto it = _entries.begin(); const auto it = absl::c_find_if(_entries, [&](auto&& entry) { return entry.name == type; });
auto end = _entries.end(); if (it == _entries.end()) {
for (; it != end && it->name != type; ++it)
;
if (it == end) {
DBG("Unsupported effect type: " << type); DBG("Unsupported effect type: " << type);
return std::make_unique<sfz::fx::Nothing>(); return std::make_unique<sfz::fx::Nothing>();
} }