summaryrefslogtreecommitdiffstats
path: root/base/stl_util-inl.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-17 21:39:16 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-17 21:39:16 +0000
commitc5e7293b2ee5e90568ffa7ea67ba3ff361450659 (patch)
tree9874b3f5ef52c01cc9e5c62eb0786830a4a37014 /base/stl_util-inl.h
parentdd8ac359edca83603382f76c096b0cafbef93688 (diff)
downloadchromium_src-c5e7293b2ee5e90568ffa7ea67ba3ff361450659.zip
chromium_src-c5e7293b2ee5e90568ffa7ea67ba3ff361450659.tar.gz
chromium_src-c5e7293b2ee5e90568ffa7ea67ba3ff361450659.tar.bz2
Revert "Revert "Add connected socket function to ClientSocketPool and ClientSocketHandle.""
This reverts commit c235c719f964cc8f7f9343177ae6d5af724be6c0. Fixes a use of deleted memory by making a copy instead of keeping a reference to the deleted memory. Review URL: http://codereview.chromium.org/113512 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16263 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/stl_util-inl.h')
-rw-r--r--base/stl_util-inl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/stl_util-inl.h b/base/stl_util-inl.h
index 54b7b29..70fa69e 100644
--- a/base/stl_util-inl.h
+++ b/base/stl_util-inl.h
@@ -447,4 +447,11 @@ std::vector<T> SetToVector(const std::set<T>& values) {
return result;
}
+// Test to see if a set, map, hash_set or hash_map contains a particular key.
+// Returns true if the key is in the collection.
+template <typename Collection, typename Key>
+bool ContainsKey(const Collection& collection, const Key& key) {
+ return collection.find(key) != collection.end();
+}
+
#endif // BASE_STL_UTIL_INL_H_