operator< again

This commit is contained in:
Pagwin 2024-11-21 18:50:52 -05:00
parent 3736ad2384
commit f83d3f70b5
No known key found for this signature in database
GPG key ID: 81137023740CA260

12
Map.hpp
View file

@ -629,7 +629,15 @@ public:
friend bool operator!=(const Map &lhs, const Map &rhs) { friend bool operator!=(const Map &lhs, const Map &rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
// TODO friend bool operator<(const Map &lhs, const Map &rhs) {
friend bool operator<(const Map &lhs, const Map &rhs) { return false; } auto l_iter = lhs.cbegin();
auto r_iter = rhs.cbegin();
for (; l_iter != lhs.cend() && r_iter != rhs.cend(); l_iter++, r_iter++) {
if (*l_iter < *r_iter) {
return true;
}
}
return lhs.size() < rhs.size();
}
}; };
} // namespace cs440 } // namespace cs440