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

Unified Diff: base/containers/scoped_ptr_map.h

Issue 1179083006: ScopedPtrMap: Added Compare template parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | base/containers/scoped_ptr_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/containers/scoped_ptr_map.h
diff --git a/base/containers/scoped_ptr_map.h b/base/containers/scoped_ptr_map.h
index 19a115316efb32dd1bd688ec70a899aae79699b9..259076f3b15a7497f10f462b06ef0fa90a05bbc3 100644
--- a/base/containers/scoped_ptr_map.h
+++ b/base/containers/scoped_ptr_map.h
@@ -5,6 +5,7 @@
#ifndef BASE_CONTAINERS_SCOPED_PTR_MAP_H_
#define BASE_CONTAINERS_SCOPED_PTR_MAP_H_
+#include <functional>
#include <map>
#include <utility>
@@ -19,11 +20,11 @@
//
// |ScopedPtr| must be a type scoped_ptr<T>. This is for compatibility with
// std::map in C++11.
-template <class Key, class ScopedPtr>
+template <class Key, class ScopedPtr, class Compare = std::less<Key>>
class ScopedPtrMap {
MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScopedPtrMap)
- using Container = std::map<Key, typename ScopedPtr::element_type*>;
+ using Container = std::map<Key, typename ScopedPtr::element_type*, Compare>;
public:
using allocator_type = typename Container::allocator_type;
@@ -32,6 +33,8 @@ class ScopedPtrMap {
using reference = typename Container::reference;
using const_reference = typename Container::const_reference;
using key_type = typename Container::key_type;
+ using mapped_type = ScopedPtr;
+ using key_compare = typename Container::key_compare;
using const_iterator = typename Container::const_iterator;
using const_reverse_iterator = typename Container::const_reverse_iterator;
« no previous file with comments | « no previous file | base/containers/scoped_ptr_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698