Simplify code with four-legged std::equal

This commit is contained in:
Zhihao Yuan 2019-11-16 21:26:49 -06:00
parent 50c91a0bcc
commit 955e1e1e6c
No known key found for this signature in database
GPG Key ID: A2E474BDAA37E11C

View File

@ -270,14 +270,10 @@ public:
operator==(const T &aRhs) const { operator==(const T &aRhs) const {
using ValueType = typename T::value_type; using ValueType = typename T::value_type;
auto tLhs = get<T>(); auto tLhs = get<T>();
if (tLhs.size() != aRhs.size()) return std::equal(std::begin(tLhs), std::end(tLhs), std::begin(aRhs),
return false; std::end(aRhs), [](const auto &lhs, const auto &rhs) {
else { return std::any_cast<const ValueType &>(lhs) == rhs;
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;
});
}
} }
private: private: