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:
authorJacques Lucke <jacques@blender.org>2020-06-09 12:58:47 +0300
committerJacques Lucke <jacques@blender.org>2020-06-09 12:58:47 +0300
commitf7c0f1b8b83ac475755b633abf59cf9f447b2d49 (patch)
tree97302f741ce4e40f6e4de9f0cfd54c7320ee7fd5 /source/blender/blenlib/BLI_vector_set.hh
parent7d2b4ae9c6ecce394130cd08694914bf93497a11 (diff)
BLI: rename ArrayRef to Span
This also renames `MutableArrayRef` to `MutableSpan`. The name "Span" works better, because `std::span` will provide similar functionality in C++20. Furthermore, a shorter, more concise name for a common data structure is nice.
Diffstat (limited to 'source/blender/blenlib/BLI_vector_set.hh')
-rw-r--r--source/blender/blenlib/BLI_vector_set.hh14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh
index a3155a3a9fd..d330d3c3247 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -32,7 +32,7 @@
* - The insertion order is important.
* - Iteration over all keys has to be fast.
* - The keys in the set are supposed to be passed to a function that does not have to know that
- * the keys are stored in a set. With a VectorSet, one can get an ArrayRef containing all keys
+ * the keys are stored in a set. With a VectorSet, one can get a Span containing all keys
* without additional copies.
*
* blender::VectorSet is implemented using open addressing in a slot array with a power-of-two
@@ -279,7 +279,7 @@ class VectorSet {
* We might be able to make this faster than sequentially adding all keys, but that is not
* implemented yet.
*/
- void add_multiple(ArrayRef<Key> keys)
+ void add_multiple(Span<Key> keys)
{
for (const Key &key : keys) {
this->add(key);
@@ -411,18 +411,18 @@ class VectorSet {
return m_keys[index];
}
- operator ArrayRef<Key>() const
+ operator Span<Key>() const
{
- return ArrayRef<Key>(m_keys, this->size());
+ return Span<Key>(m_keys, this->size());
}
/**
- * Get an ArrayRef referencing the keys vector. The referenced memory buffer is only valid as
+ * Get an Span referencing the keys vector. The referenced memory buffer is only valid as
* long as the vector set is not changed.
*
* The keys must not be changed, because this would change their hash value.
*/
- ArrayRef<Key> as_ref() const
+ Span<Key> as_span() const
{
return *this;
}
@@ -432,7 +432,7 @@ class VectorSet {
*/
void print_stats(StringRef name = "") const
{
- HashTableStats stats(*this, this->as_ref());
+ HashTableStats stats(*this, this->as_span());
stats.print();
}