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:
authorHans Goudey <h.goudey@me.com>2022-01-18 00:10:52 +0300
committerHans Goudey <h.goudey@me.com>2022-01-18 00:10:52 +0300
commit44ca984dc7b150e5fd6ad88b999d0dbdc7cb9218 (patch)
tree804b89397a8f21ad61330121404fb332555a2460 /source/blender/blenlib/BLI_vector_set.hh
parent8c1ddee10cfe11c2dba8a5005290db20546c2cb6 (diff)
BLI: Add index_range method to VectorSet
This can simplify iterating through all of the indices in the vector, which is fairly common, since one of the benefits of the data structure is that all values are contiguous.
Diffstat (limited to 'source/blender/blenlib/BLI_vector_set.hh')
-rw-r--r--source/blender/blenlib/BLI_vector_set.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh
index cc9cb585a1c..0aac96f93bc 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -465,6 +465,14 @@ class VectorSet {
}
/**
+ * Get an index range containing all valid indices for this array.
+ */
+ IndexRange index_range() const
+ {
+ return IndexRange(this->size());
+ }
+
+ /**
* Print common statistics like size and collision count. This is useful for debugging purposes.
*/
void print_stats(StringRef name = "") const