replace std::equal with std::ranges::equal where appropriate

the c++-20 constrained algorithm is safer and code is more readable
This commit is contained in:
Arne Morten Kvarving committed 2026-02-24 11:30:38 +01:00
1 parent f95847e8e7
commit 70e70b65e3
2 files changed
+5 -12

No files matched your search

@@ -375,8 +375,7 @@ public:
bool operator==(const BlockVectorWrapper& wrapper) const
{
return std::equal(this->blockVector_.begin(), this->blockVector_.end(),
wrapper.blockVector_.begin(), wrapper.blockVector_.end());
return std::ranges::equal(this->blockVector_, wrapper.blockVector_);
}
template<class Serializer>
@@ -1904,12 +1903,9 @@ public:
bool operator==(const FvBaseDiscretization& rhs) const
{
return std::equal(this->solution_.begin(), this->solution_.end(),
rhs.solution_.begin(), rhs.solution_.end(),
[](const auto& x, const auto& y)
{
return *x == *y;
});
return std::ranges::equal(this->solution_, rhs.solution_,
[](const auto& x, const auto& y)
{ return *x == *y; });
}
protected:
+1 -4
View File
@@ -443,10 +443,7 @@ public:
return false;
}
for (size_t i = 0; i < this->tracerConcentration_.size(); ++i) {
if (!std::equal(this->tracerConcentration_[i].begin(),
this->tracerConcentration_[i].end(),
rhs.tracerConcentration_[i].begin(),
rhs.tracerConcentration_[i].end())) {
if (!std::ranges::equal(this->tracerConcentration_[i], rhs.tracerConcentration_[i])) {
return false;
}
}