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

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

Issue 2014403002: Mojo C++ bindings: custom type mapping of map (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/serialization_util.h ('k') | mojo/public/cpp/bindings/map_traits.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 f1cdd41ae7cb923de9724051647dd67951980704..4f607009253a580cf638282155c32eb6083d1302 100644
--- a/mojo/public/cpp/bindings/map.h
+++ b/mojo/public/cpp/bindings/map.h
@@ -36,6 +36,7 @@ class Map {
static_assert(!internal::IsMoveOnlyType<Key>::value,
"Map keys cannot be move only types.");
+ using Iterator = typename std::map<Key, Value>::iterator;
using ConstIterator = typename std::map<Key, Value>::const_iterator;
using Data_ = internal::Map_Data<
@@ -223,11 +224,15 @@ class Map {
// Provide read-only iteration over map members in a way similar to STL
// collections.
ConstIterator begin() const { return map_.begin(); }
+ Iterator begin() { return map_.begin(); }
+
ConstIterator end() const { return map_.end(); }
+ Iterator end() { return map_.end(); }
// Returns the iterator pointing to the entry for |key|, if present, or else
// returns end().
ConstIterator find(const Key& key) const { return map_.find(key); }
+ Iterator find(const Key& key) { return map_.find(key); }
private:
typedef std::map<Key, Value> Map::*Testable;
@@ -240,7 +245,9 @@ class Map {
private:
using Traits =
- internal::MapTraits<Key, Value, internal::IsMoveOnlyType<Value>::value>;
+ internal::MapCloneTraits<Key,
+ Value,
+ internal::IsMoveOnlyType<Value>::value>;
// Forbid the == and != operators explicitly, otherwise Map will be converted
// to Testable to do == or != comparison.
« no previous file with comments | « mojo/public/cpp/bindings/lib/serialization_util.h ('k') | mojo/public/cpp/bindings/map_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698