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

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

Issue 2339413004: Allow Mojo structs as map keys (Closed)
Patch Set: Revert no-longer-needed changes to clone_equals_util.h Created 4 years, 3 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
Index: mojo/public/cpp/bindings/map_traits_stl.h
diff --git a/mojo/public/cpp/bindings/map_traits_stl.h b/mojo/public/cpp/bindings/map_traits_stl.h
index ff79a200d3e87bbf229f92206930db6af8c62bd9..83a4399ce064597cb3062ffa94303d5a0d5af6c1 100644
--- a/mojo/public/cpp/bindings/map_traits_stl.h
+++ b/mojo/public/cpp/bindings/map_traits_stl.h
@@ -94,14 +94,10 @@ struct MapTraits<std::unordered_map<K, V>> {
static V& GetValue(Iterator& iterator) { return iterator->second; }
static const V& GetValue(ConstIterator& iterator) { return iterator->second; }
- static bool Insert(std::unordered_map<K, V>& input, const K& key, V&& value) {
- input.insert(std::make_pair(key, std::forward<V>(value)));
- return true;
- }
- static bool Insert(std::unordered_map<K, V>& input,
- const K& key,
- const V& value) {
- input.insert(std::make_pair(key, value));
+ template <typename IK, typename IV>
+ static bool Insert(std::unordered_map<K, V>& input, IK&& key, IV&& value) {
+ input.insert(
+ std::make_pair(std::forward<IK>(key), std::forward<IV>(value)));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698