[Bf-blender-cvs] [9bd835e1fb5] functions: don't use linear search in SmallSetVector
Jacques Lucke
noreply at git.blender.org
Mon Apr 15 15:35:03 CEST 2019
Commit: 9bd835e1fb52efe392c6e31b71cfa70492bb2151
Author: Jacques Lucke
Date: Mon Apr 15 14:31:18 2019 +0200
Branches: functions
https://developer.blender.org/rB9bd835e1fb52efe392c6e31b71cfa70492bb2151
don't use linear search in SmallSetVector
===================================================================
M source/blender/blenlib/BLI_small_set_vector.hpp
===================================================================
diff --git a/source/blender/blenlib/BLI_small_set_vector.hpp b/source/blender/blenlib/BLI_small_set_vector.hpp
index 3e25e603a3f..bdf605df556 100644
--- a/source/blender/blenlib/BLI_small_set_vector.hpp
+++ b/source/blender/blenlib/BLI_small_set_vector.hpp
@@ -18,12 +18,7 @@ namespace BLI {
int index(const T &value) const
{
- for (uint i = 0; i < this->size(); i++) {
- if (this->m_elements[i] == value) {
- return i;
- }
- }
- return -1;
+ return this->m_lookup.find(this->m_elements.begin(), value);
}
T operator[](const int index) const
@@ -33,4 +28,4 @@ namespace BLI {
}
};
-};
\ No newline at end of file
+};
More information about the Bf-blender-cvs
mailing list