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:
Diffstat (limited to 'source/blender/blenlib/BLI_set_vector.h')
-rw-r--r--source/blender/blenlib/BLI_set_vector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_set_vector.h b/source/blender/blenlib/BLI_set_vector.h
index 92c660a88f2..36e69e7e3cc 100644
--- a/source/blender/blenlib/BLI_set_vector.h
+++ b/source/blender/blenlib/BLI_set_vector.h
@@ -132,6 +132,16 @@ template<typename T, typename Allocator = GuardedAllocator> class SetVector {
}
/**
+ * Allocate memory such that at least min_usable_slots can be added without having to grow again.
+ */
+ void reserve(uint min_usable_slots)
+ {
+ if (m_array.slots_usable() < min_usable_slots) {
+ this->grow(min_usable_slots);
+ }
+ }
+
+ /**
* Add a new element. The method assumes that the value did not exist before.
*/
void add_new(const T &value)