Refactoring: Use STL algorithms
This commit is contained in:
parent
c8dce14303
commit
69faa0d8c8
27
lib/token.h
27
lib/token.h
|
@ -924,11 +924,10 @@ public:
|
|||
const ValueFlow::Value * getValue(const MathLib::bigint val) const {
|
||||
if (!mImpl->mValues)
|
||||
return nullptr;
|
||||
for (const ValueFlow::Value &value : *mImpl->mValues) {
|
||||
if (value.isIntValue() && value.intvalue == val)
|
||||
return &value;
|
||||
}
|
||||
return nullptr;
|
||||
const auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [=](const ValueFlow::Value &value) {
|
||||
return value.isIntValue() && value.intvalue == val;
|
||||
});
|
||||
return it == mImpl->mValues->end() ? nullptr : &*it;;
|
||||
}
|
||||
|
||||
const ValueFlow::Value * getMaxValue(bool condition) const {
|
||||
|
@ -948,11 +947,10 @@ public:
|
|||
const ValueFlow::Value * getMovedValue() const {
|
||||
if (!mImpl->mValues)
|
||||
return nullptr;
|
||||
for (const ValueFlow::Value &value : *mImpl->mValues) {
|
||||
if (value.isMovedValue() && value.moveKind != ValueFlow::Value::NonMovedVariable)
|
||||
return &value;
|
||||
}
|
||||
return nullptr;
|
||||
const auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [](const ValueFlow::Value &value) {
|
||||
return value.isMovedValue() && value.moveKind != ValueFlow::Value::NonMovedVariable;
|
||||
});
|
||||
return it == mImpl->mValues->end() ? nullptr : &*it;;
|
||||
}
|
||||
|
||||
const ValueFlow::Value * getValueLE(const MathLib::bigint val, const Settings *settings) const;
|
||||
|
@ -963,11 +961,10 @@ public:
|
|||
const ValueFlow::Value * getContainerSizeValue(const MathLib::bigint val) const {
|
||||
if (!mImpl->mValues)
|
||||
return nullptr;
|
||||
for (const ValueFlow::Value &value : *mImpl->mValues) {
|
||||
if (value.isContainerSizeValue() && value.intvalue == val)
|
||||
return &value;
|
||||
}
|
||||
return nullptr;
|
||||
const auto it = std::find_if(mImpl->mValues->begin(), mImpl->mValues->end(), [=](const ValueFlow::Value &value) {
|
||||
return value.isContainerSizeValue() && value.intvalue == val;
|
||||
});
|
||||
return it == mImpl->mValues->end() ? nullptr : &*it;;
|
||||
}
|
||||
|
||||
const Token *getValueTokenMaxStrLength() const;
|
||||
|
|
Loading…
Reference in New Issue