From 649916f0983e4c59201672e6e28dcc7ae1f655b2 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Sun, 7 Mar 2021 14:24:52 +0100 Subject: 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. --- source/blender/blenlib/tests/BLI_linear_allocator_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/tests/BLI_linear_allocator_test.cc') 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 values = {1, 2, 3, 4, 5}; - Vector *vector = allocator.construct>(values); + Vector *vector = allocator.construct>(values).release(); EXPECT_EQ(vector->size(), 5); EXPECT_EQ((*vector)[3], 4); vector->~Vector(); -- cgit v1.2.3