Skip to content

Commit 3956220

Browse files
committed
Use find_if
1 parent dbf50fd commit 3956220

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

test/testvalueflow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,11 @@ class TestValueFlow : public TestFixture {
526526
const Token* tok = Token::findmatch(tokenizer.tokens(), tokstr);
527527
if (!tok)
528528
return "";
529-
for (const ValueFlow::Value& v : tok->values()) {
530-
if (v.isContainerSizeValue() && v.container)
531-
return v.container->expressionString();
532-
}
533-
return "";
529+
const std::list<ValueFlow::Value>& values = tok->values();
530+
const auto it = std::find_if(values.cbegin(), values.cend(), [](const ValueFlow::Value& v) {
531+
return v.isContainerSizeValue() && v.container;
532+
});
533+
return it == values.cend() ? "" : it->container->expressionString();
534534
}
535535

536536
#define lifetimeValues(...) lifetimeValues_(__FILE__, __LINE__, __VA_ARGS__)

0 commit comments

Comments
 (0)