Commit: 44ca984dc7b150e5fd6ad88b999d0dbdc7cb9218 Author: Hans Goudey Date: Mon Jan 17 15:10:52 2022 -0600 Branches: master https://developer.blender.org/rB44ca984dc7b150e5fd6ad88b999d0dbdc7cb9218
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. =================================================================== M source/blender/blenlib/BLI_vector_set.hh =================================================================== 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 @@ -464,6 +464,14 @@ class VectorSet { return keys_ + this->size(); } + /** + * 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. */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs