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_stack_cxx_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_stack_cxx_test.cc')
-rw-r--r-- | tests/gtests/blenlib/BLI_stack_cxx_test.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/gtests/blenlib/BLI_stack_cxx_test.cc b/tests/gtests/blenlib/BLI_stack_cxx_test.cc index 02c5407fda3..436f1f307b9 100644 --- a/tests/gtests/blenlib/BLI_stack_cxx_test.cc +++ b/tests/gtests/blenlib/BLI_stack_cxx_test.cc @@ -1,7 +1,8 @@ #include "testing/testing.h" #include "BLI_stack_cxx.h" -using IntStack = BLI::Stack<int>; +using BLI::Stack; +using IntStack = Stack<int>; TEST(stack, DefaultConstructor) { @@ -50,3 +51,13 @@ TEST(stack, Peek) stack.pop(); EXPECT_EQ(stack.peek(), 3); } + +TEST(stack, UniquePtrValues) +{ + Stack<std::unique_ptr<int>> stack; + stack.push(std::unique_ptr<int>(new int())); + stack.push(std::unique_ptr<int>(new int())); + std::unique_ptr<int> a = stack.pop(); + std::unique_ptr<int> &b = stack.peek(); + UNUSED_VARS(a, b); +} |