Index: base/stl_util.h |
diff --git a/base/stl_util.h b/base/stl_util.h |
index 016bb156450692415d9814f6a011446cf68ca591..56025ca0eddca00ac51bf470b4e8b3cc13391d45 100644 |
--- a/base/stl_util.h |
+++ b/base/stl_util.h |
@@ -10,6 +10,7 @@ |
#include <algorithm> |
#include <functional> |
#include <iterator> |
+#include <memory> |
#include <string> |
#include <vector> |
@@ -126,6 +127,15 @@ bool STLIncludes(const Arg1& a1, const Arg2& a2) { |
a2.begin(), a2.end()); |
} |
+// Means of generating a key for searching STL collections of std::unique_ptr |
+// that avoids the side effect of deleting the pointer. |
+template <class T> |
+class FakeUniquePtr : public std::unique_ptr<T> { |
+ public: |
+ using std::unique_ptr<T>::unique_ptr; |
+ ~FakeUniquePtr() { std::unique_ptr<T>::release(); } |
+}; |
+ |
} // namespace base |
#endif // BASE_STL_UTIL_H_ |