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.
This commit is contained in:
Hans Goudey 2022-01-17 15:10:52 -06:00
parent 8c1ddee10c
commit 44ca984dc7
1 changed files with 8 additions and 0 deletions

View File

@ -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.
*/