diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-07 16:24:52 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-07 16:24:52 +0300 |
commit | 649916f0983e4c59201672e6e28dcc7ae1f655b2 (patch) | |
tree | f8caa573963f0af1897b25cbda1352c5ea7474a1 /source/blender/blenlib/tests | |
parent | 456d3cc85e9f408341b12eb0d4f2c3a925855e8c (diff) |
BLI: make it harder to forget to destruct a value
Instead of returning a raw pointer, `LinearAllocator.construct(...)` now returns
a `destruct_ptr`, which is similar to `unique_ptr`, but does not deallocate
the memory and only calls the destructor instead.
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r-- | source/blender/blenlib/tests/BLI_linear_allocator_test.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc index 95156ae5c0c..977e5dba497 100644 --- a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc +++ b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc @@ -79,7 +79,7 @@ TEST(linear_allocator, Construct) LinearAllocator<> allocator; std::array<int, 5> values = {1, 2, 3, 4, 5}; - Vector<int> *vector = allocator.construct<Vector<int>>(values); + Vector<int> *vector = allocator.construct<Vector<int>>(values).release(); EXPECT_EQ(vector->size(), 5); EXPECT_EQ((*vector)[3], 4); vector->~Vector(); |