mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-24 22:57:42 -05:00
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:
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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user