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_vector_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_vector_test.cc')
-rw-r--r-- | tests/gtests/blenlib/BLI_vector_test.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_vector_test.cc b/tests/gtests/blenlib/BLI_vector_test.cc index 60f78025269..9486c9c0ef2 100644 --- a/tests/gtests/blenlib/BLI_vector_test.cc +++ b/tests/gtests/blenlib/BLI_vector_test.cc @@ -398,3 +398,17 @@ TEST(vector, AppendNTimes) EXPECT_EQ(a[3], 2); EXPECT_EQ(a[4], 2); } + +TEST(vector, UniquePtrValue) +{ + Vector<std::unique_ptr<int>> vec; + vec.append(std::unique_ptr<int>(new int())); + vec.append(std::unique_ptr<int>(new int())); + vec.append(std::unique_ptr<int>(new int())); + + std::unique_ptr<int> &a = vec.last(); + std::unique_ptr<int> b = vec.pop_last(); + vec.remove_and_reorder(0); + + UNUSED_VARS(a, b); +} |