mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Simplify code with four-legged std::equal
This commit is contained in:
parent
50c91a0bcc
commit
955e1e1e6c
@ -270,14 +270,10 @@ public:
|
||||
operator==(const T &aRhs) const {
|
||||
using ValueType = typename T::value_type;
|
||||
auto tLhs = get<T>();
|
||||
if (tLhs.size() != aRhs.size())
|
||||
return false;
|
||||
else {
|
||||
return std::equal(std::begin(tLhs), std::end(tLhs), std::begin(aRhs),
|
||||
[](const auto &lhs, const auto &rhs) {
|
||||
return std::any_cast<const ValueType &>(lhs) == rhs;
|
||||
});
|
||||
}
|
||||
return std::equal(std::begin(tLhs), std::end(tLhs), std::begin(aRhs),
|
||||
std::end(aRhs), [](const auto &lhs, const auto &rhs) {
|
||||
return std::any_cast<const ValueType &>(lhs) == rhs;
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user