Commit: f149445d386087743b89804763a9155e2dde370a
Author: Jacques Lucke
Date: Fri Aug 2 18:51:02 2019 +0200
Branches: functions
https://developer.blender.org/rBf149445d386087743b89804763a9155e2dde370a
vector.fill_indices
===================================================================
M source/blender/blenlib/BLI_vector.hpp
M tests/gtests/blenlib/BLI_vector_test.cc
===================================================================
diff --git a/source/blender/blenlib/BLI_vector.hpp
b/source/blender/blenlib/BLI_vector.hpp
index c53931612f9..dcd5a407a92 100644
--- a/source/blender/blenlib/BLI_vector.hpp
+++ b/source/blender/blenlib/BLI_vector.hpp
@@ -335,6 +335,11 @@ template<typename T, uint N = 4> class Vector {
}
}
+ void fill_indices(ArrayRef<uint> indices, const T &value)
+ {
+ ArrayRef<T>(*this).fill_indices(indices, value);
+ }
+
/**
* Return how many values are currently stored in the vector.
*/
diff --git a/tests/gtests/blenlib/BLI_vector_test.cc
b/tests/gtests/blenlib/BLI_vector_test.cc
index 38eada82d70..ce2aaeff54b 100644
--- a/tests/gtests/blenlib/BLI_vector_test.cc
+++ b/tests/gtests/blenlib/BLI_vector_test.cc
@@ -178,6 +178,17 @@ TEST(vector, Fill)
EXPECT_EQ(vec[4], 3);
}
+TEST(vector, FillIndices)
+{
+ IntVector vec(5, 0);
+ vec.fill_indices({1, 2}, 4);
+ EXPECT_EQ(vec[0], 0);
+ EXPECT_EQ(vec[1], 4);
+ EXPECT_EQ(vec[2], 4);
+ EXPECT_EQ(vec[3], 0);
+ EXPECT_EQ(vec[4], 0);
+}
+
TEST(vector, Iterator)
{
IntVector vec({1, 4, 9, 16});
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs