[Bf-blender-cvs] [bbb3770be23] functions: speedup size constructor of small vector
Jacques Lucke
noreply at git.blender.org
Fri May 3 12:43:45 CEST 2019
Commit: bbb3770be23673724d0c601152eafc7759b591ca
Author: Jacques Lucke
Date: Fri May 3 12:42:50 2019 +0200
Branches: functions
https://developer.blender.org/rBbbb3770be23673724d0c601152eafc7759b591ca
speedup size constructor of small vector
===================================================================
M source/blender/blenlib/BLI_small_vector.hpp
===================================================================
diff --git a/source/blender/blenlib/BLI_small_vector.hpp b/source/blender/blenlib/BLI_small_vector.hpp
index 37406723770..25d712cf25e 100644
--- a/source/blender/blenlib/BLI_small_vector.hpp
+++ b/source/blender/blenlib/BLI_small_vector.hpp
@@ -38,8 +38,9 @@ template<typename T, uint N = 4> class SmallVector {
{
this->reserve(size);
for (uint i = 0; i < size; i++) {
- this->append(T());
+ new (this->element_ptr(i)) T();
}
+ m_size = size;
}
SmallVector(std::initializer_list<T> values) : SmallVector()
More information about the Bf-blender-cvs
mailing list