Index: mojo/public/cpp/bindings/array.h |
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h |
index f522faab532a4d5d6276098cfc8fd907835b0471..e9bd6838412e94fcd927f58637e98e1faa44d66f 100644 |
--- a/mojo/public/cpp/bindings/array.h |
+++ b/mojo/public/cpp/bindings/array.h |
@@ -295,6 +295,16 @@ struct TypeConverter<std::set<E>, Array<T>> { |
} |
}; |
+// Less than operator to allow Arrays as keys in std maps and sets. |
+template <typename T> |
+inline bool operator<(const Array<T>& a, const Array<T>& b) { |
+ if (a.is_null()) |
+ return !b.is_null(); |
+ if (b.is_null()) |
+ return false; |
+ return a.storage() < b.storage(); |
+} |
+ |
} // namespace mojo |
#endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ |