| Index: base/containers/flat_map_unittest.cc
|
| diff --git a/base/containers/flat_map_unittest.cc b/base/containers/flat_map_unittest.cc
|
| index 0556527635a69ebe16153cd33134fdefc8e96fe6..f2c211e955a9b4fda36951466d99628a6272337c 100644
|
| --- a/base/containers/flat_map_unittest.cc
|
| +++ b/base/containers/flat_map_unittest.cc
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/containers/container_test_utils.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -170,4 +171,27 @@ TEST(FlatMap, SubscriptMoveOnlyKey) {
|
| EXPECT_EQ(44, m[MoveOnlyInt(1)]);
|
| }
|
|
|
| +TEST(FlatMap, UniquePtrKeys) {
|
| + base::flat_map<std::unique_ptr<int>, int> m;
|
| + const auto& m1 = m;
|
| + int x = 0;
|
| + m.count(&x);
|
| + m1.count(&x);
|
| + m.find(&x);
|
| + m1.find(&x);
|
| + m.equal_range(&x);
|
| + m1.equal_range(&x);
|
| + m.lower_bound(&x);
|
| + m1.lower_bound(&x);
|
| + m.upper_bound(&x);
|
| + m1.upper_bound(&x);
|
| + m.erase(&x);
|
| +
|
| + // Check if we broke overload resolution.
|
| + m.emplace(base::MakeUnique<int>(0), 0);
|
| + m.emplace(base::MakeUnique<int>(1), 0);
|
| + m.erase(m.begin());
|
| + m.erase(m.cbegin());
|
| +}
|
| +
|
| } // namespace base
|
|
|