Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1757)

Unified Diff: mojo/public/cpp/bindings/map.h

Issue 649633003: Add Equals() to mojom structs and related types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reorder Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/template_util.h ('k') | mojo/public/cpp/bindings/struct_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/map.h
diff --git a/mojo/public/cpp/bindings/map.h b/mojo/public/cpp/bindings/map.h
index 0ee66fb46b8f9ce8b550b6bb2a452a580a4e9034..f09937a40046c98e9b5f2f1cb5e684191957af6b 100644
--- a/mojo/public/cpp/bindings/map.h
+++ b/mojo/public/cpp/bindings/map.h
@@ -117,6 +117,24 @@ class Map {
return result.Pass();
}
+ bool Equals(const Map& other) const {
+ if (is_null() != other.is_null())
+ return false;
+ if (size() != other.size())
+ return false;
+ auto i = begin();
+ auto j = other.begin();
+ while (i != end()) {
+ if (i.GetKey() != j.GetKey())
+ return false;
+ if (!internal::ValueTraits<Value>::Equals(i.GetValue(), j.GetValue()))
+ return false;
+ ++i;
+ ++j;
+ }
+ return true;
+ }
+
class ConstMapIterator {
public:
ConstMapIterator(
« no previous file with comments | « mojo/public/cpp/bindings/lib/template_util.h ('k') | mojo/public/cpp/bindings/struct_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698