[Bf-blender-cvs] [6507449e54a] master: Cleanup: fix wrong merge, remove extra unique_ptr.

Ankit Meel noreply at git.blender.org
Mon Nov 9 15:02:21 CET 2020


Commit: 6507449e54a167c63a72229e4d0119dd2af68ae5
Author: Ankit Meel
Date:   Mon Nov 9 19:06:10 2020 +0530
Branches: master
https://developer.blender.org/rB6507449e54a167c63a72229e4d0119dd2af68ae5

Cleanup: fix wrong merge, remove extra unique_ptr.

Mistakes added in 3cb4c513080ebeead7c5629a7f0503fae9513803 and
bec1765340c3c13f002882ce147762e4c38ed2c6

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9514

===================================================================

M	source/blender/blenlib/intern/mesh_intersect.cc
M	source/blender/blenlib/tests/BLI_map_test.cc
M	source/blender/blenlib/tests/BLI_set_test.cc
M	source/blender/blenlib/tests/BLI_stack_cxx_test.cc
M	source/blender/blenlib/tests/BLI_vector_set_test.cc
M	source/blender/blenlib/tests/BLI_vector_test.cc

===================================================================

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();



More information about the Bf-blender-cvs mailing list