diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-09-14 13:11:14 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-09-14 13:11:14 +0300 |
commit | 79e1165bd7488850e896112c2b0f8bf1e6b25db9 (patch) | |
tree | 1cb20163e2aaff754e295360457b1f15428eca25 /tests/gtests/blenlib/BLI_string_map_test.cc | |
parent | ca76ecfa0ee1153677d8c89149000c7e9a5814d6 (diff) |
BLI: Improve forwarding semantics of some data structures
This makes it possible to use e.g. `std::unique_ptr` in a map.
Diffstat (limited to 'tests/gtests/blenlib/BLI_string_map_test.cc')
-rw-r--r-- | tests/gtests/blenlib/BLI_string_map_test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_string_map_test.cc b/tests/gtests/blenlib/BLI_string_map_test.cc index e5e32352161..cc02a54e0c8 100644 --- a/tests/gtests/blenlib/BLI_string_map_test.cc +++ b/tests/gtests/blenlib/BLI_string_map_test.cc @@ -199,3 +199,12 @@ TEST(string_map, WithVectors) EXPECT_EQ(map.lookup("A").size(), 3); EXPECT_EQ(map.lookup("B").size(), 7); } + +TEST(string_map, UniquePtrValues) +{ + StringMap<std::unique_ptr<int>> map; + map.add_new("A", std::unique_ptr<int>(new int())); + std::unique_ptr<int> &a = map.lookup("A"); + std::unique_ptr<int> *b = map.lookup_ptr("A"); + EXPECT_EQ(a.get(), b->get()); +} |