Use static array to store iterator infer models instead of constructing a vector everytime (#3539)
This commit is contained in:
parent
54d621555d
commit
04ecf53a07
|
@ -101,6 +101,7 @@
|
|||
#include "valueptr.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
@ -5538,8 +5539,9 @@ static void valueFlowInferCondition(TokenList* tokenlist,
|
|||
setTokenValue(tok, value, settings);
|
||||
} else if (Token::Match(tok, "%comp%|-") && tok->astOperand1() && tok->astOperand2()) {
|
||||
if (astIsIterator(tok->astOperand1()) || astIsIterator(tok->astOperand2())) {
|
||||
for (ValuePtr<InferModel> model :
|
||||
std::vector<ValuePtr<InferModel>>{EndIteratorInferModel{}, StartIteratorInferModel{}}) {
|
||||
static const std::array<ValuePtr<InferModel>, 2> iteratorModels = {EndIteratorInferModel{},
|
||||
StartIteratorInferModel{}};
|
||||
for (const ValuePtr<InferModel>& model : iteratorModels) {
|
||||
std::vector<ValueFlow::Value> result =
|
||||
infer(model, tok->str(), tok->astOperand1()->values(), tok->astOperand2()->values());
|
||||
for (ValueFlow::Value value : result) {
|
||||
|
|
Loading…
Reference in New Issue