From f7c0f1b8b83ac475755b633abf59cf9f447b2d49 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 9 Jun 2020 11:58:47 +0200 Subject: 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. --- source/blender/blenlib/BLI_vector_set.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '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 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 keys) + void add_multiple(Span keys) { for (const Key &key : keys) { this->add(key); @@ -411,18 +411,18 @@ class VectorSet { return m_keys[index]; } - operator ArrayRef() const + operator Span() const { - return ArrayRef(m_keys, this->size()); + return Span(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 as_ref() const + Span 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(); } -- cgit v1.2.3