Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Meel <ankitjmeel@gmail.com>2020-11-09 16:36:10 +0300
committerAnkit Meel <ankitjmeel@gmail.com>2020-11-09 17:02:16 +0300
commit6507449e54a167c63a72229e4d0119dd2af68ae5 (patch)
treebe324f570d53a2d2982a5fee626c166dddfd1f27
parent021c40167dea0fae056775f979a6e94c8fcc2a37 (diff)
Cleanup: fix wrong merge, remove extra unique_ptr.
Mistakes added in 3cb4c513080ebeead7c5629a7f0503fae9513803 and bec1765340c3c13f002882ce147762e4c38ed2c6 Reviewed By: sergey Differential Revision: https://developer.blender.org/D9514
-rw-r--r--source/blender/blenlib/intern/mesh_intersect.cc1
-rw-r--r--source/blender/blenlib/tests/BLI_map_test.cc19
-rw-r--r--source/blender/blenlib/tests/BLI_set_test.cc6
-rw-r--r--source/blender/blenlib/tests/BLI_stack_cxx_test.cc4
-rw-r--r--source/blender/blenlib/tests/BLI_vector_set_test.cc6
-rw-r--r--source/blender/blenlib/tests/BLI_vector_test.cc8
6 files changed, 23 insertions, 21 deletions
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index 58f78be13b6..1eea58e4eb2 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -24,6 +24,7 @@
# include <algorithm>
# include <fstream>
# include <iostream>
+# include <memory>
# include "BLI_allocator.hh"
# include "BLI_array.hh"
diff --git a/source/blender/blenlib/tests/BLI_map_test.cc b/source/blender/blenlib/tests/BLI_map_test.cc
index ecdf2627520..323ced87d9e 100644
--- a/source/blender/blenlib/tests/BLI_map_test.cc
+++ b/source/blender/blenlib/tests/BLI_map_test.cc
@@ -8,6 +8,7 @@
#include "BLI_timeit.hh"
#include "BLI_vector.hh"
#include "testing/testing.h"
+#include <memory>
namespace blender::tests {
@@ -419,9 +420,9 @@ TEST(map, Clear)
TEST(map, UniquePtrValue)
{
- auto value1 = std::unique_ptr<int>(std::make_unique<int>());
- auto value2 = std::unique_ptr<int>(std::make_unique<int>());
- auto value3 = std::unique_ptr<int>(std::make_unique<int>());
+ auto value1 = std::make_unique<int>();
+ auto value2 = std::make_unique<int>();
+ auto value3 = std::make_unique<int>();
int *value1_ptr = value1.get();
@@ -429,12 +430,12 @@ TEST(map, UniquePtrValue)
map.add_new(1, std::move(value1));
map.add(2, std::move(value2));
map.add_overwrite(3, std::move(value3));
- map.lookup_or_add_cb(4, []() { return std::unique_ptr<int>(std::make_unique<int>()); });
- map.add_new(5, std::unique_ptr<int>(std::make_unique<int>()));
- map.add(6, std::unique_ptr<int>(std::make_unique<int>()));
- map.add_overwrite(7, std::unique_ptr<int>(std::make_unique<int>()));
- map.lookup_or_add(8, std::unique_ptr<int>(std::make_unique<int>()));
- map.pop_default(9, std::unique_ptr<int>(std::make_unique<int>()));
+ map.lookup_or_add_cb(4, []() { return std::make_unique<int>(); });
+ map.add_new(5, std::make_unique<int>());
+ map.add(6, std::make_unique<int>());
+ map.add_overwrite(7, std::make_unique<int>());
+ map.lookup_or_add(8, std::make_unique<int>());
+ map.pop_default(9, std::make_unique<int>());
EXPECT_EQ(map.lookup(1).get(), value1_ptr);
EXPECT_EQ(map.lookup_ptr(100), nullptr);
diff --git a/source/blender/blenlib/tests/BLI_set_test.cc b/source/blender/blenlib/tests/BLI_set_test.cc
index 840472e4c0b..ea4369d6b8f 100644
--- a/source/blender/blenlib/tests/BLI_set_test.cc
+++ b/source/blender/blenlib/tests/BLI_set_test.cc
@@ -221,10 +221,10 @@ TEST(set, OftenAddRemoveContained)
TEST(set, UniquePtrValues)
{
Set<std::unique_ptr<int>> set;
- set.add_new(std::unique_ptr<int>(std::make_unique<int>()));
- auto value1 = std::unique_ptr<int>(std::make_unique<int>());
+ set.add_new(std::make_unique<int>());
+ auto value1 = std::make_unique<int>();
set.add_new(std::move(value1));
- set.add(std::unique_ptr<int>(std::make_unique<int>()));
+ set.add(std::make_unique<int>());
EXPECT_EQ(set.size(), 3);
}
diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
index 57e7bfdfdce..f1fcdae3a52 100644
--- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
+++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc
@@ -170,8 +170,8 @@ TEST(stack, Peek)
TEST(stack, UniquePtrValues)
{
Stack<std::unique_ptr<int>> stack;
- stack.push(std::unique_ptr<int>(std::make_unique<int>()));
- stack.push(std::unique_ptr<int>(std::make_unique<int>()));
+ stack.push(std::make_unique<int>());
+ stack.push(std::make_unique<int>());
std::unique_ptr<int> a = stack.pop();
std::unique_ptr<int> &b = stack.peek();
UNUSED_VARS(a, b);
diff --git a/source/blender/blenlib/tests/BLI_vector_set_test.cc b/source/blender/blenlib/tests/BLI_vector_set_test.cc
index cbdc597255a..bbbe96f9b7e 100644
--- a/source/blender/blenlib/tests/BLI_vector_set_test.cc
+++ b/source/blender/blenlib/tests/BLI_vector_set_test.cc
@@ -142,9 +142,9 @@ TEST(vector_set, AddMultipleTimes)
TEST(vector_set, UniquePtrValue)
{
VectorSet<std::unique_ptr<int>> set;
- set.add_new(std::unique_ptr<int>(std::make_unique<int>()));
- set.add(std::unique_ptr<int>(std::make_unique<int>()));
- set.index_of_try(std::unique_ptr<int>(std::make_unique<int>()));
+ set.add_new(std::make_unique<int>());
+ set.add(std::make_unique<int>());
+ set.index_of_try(std::make_unique<int>());
std::unique_ptr<int> value = set.pop();
UNUSED_VARS(value);
}
diff --git a/source/blender/blenlib/tests/BLI_vector_test.cc b/source/blender/blenlib/tests/BLI_vector_test.cc
index 0088ae21983..462f13c15ab 100644
--- a/source/blender/blenlib/tests/BLI_vector_test.cc
+++ b/source/blender/blenlib/tests/BLI_vector_test.cc
@@ -456,10 +456,10 @@ TEST(vector, AppendNTimes)
TEST(vector, UniquePtrValue)
{
Vector<std::unique_ptr<int>> vec;
- vec.append(std::unique_ptr<int>(std::make_unique<int>()));
- vec.append(std::unique_ptr<int>(std::make_unique<int>()));
- vec.append(std::unique_ptr<int>(std::make_unique<int>()));
- vec.append(std::unique_ptr<int>(std::make_unique<int>()));
+ vec.append(std::make_unique<int>());
+ vec.append(std::make_unique<int>());
+ vec.append(std::make_unique<int>());
+ vec.append(std::make_unique<int>());
EXPECT_EQ(vec.size(), 4);
std::unique_ptr<int> &a = vec.last();