diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-09 12:58:47 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-09 12:58:47 +0300 |
commit | f7c0f1b8b83ac475755b633abf59cf9f447b2d49 (patch) | |
tree | 97302f741ce4e40f6e4de9f0cfd54c7320ee7fd5 /source/blender/blenlib/BLI_array.hh | |
parent | 7d2b4ae9c6ecce394130cd08694914bf93497a11 (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_array.hh')
-rw-r--r-- | source/blender/blenlib/BLI_array.hh | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index 874cd6b215a..b929d1220da 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -39,9 +39,9 @@ */ #include "BLI_allocator.hh" -#include "BLI_array_ref.hh" #include "BLI_index_range.hh" #include "BLI_memory_utils.hh" +#include "BLI_span.hh" #include "BLI_utildefines.h" namespace blender { @@ -90,7 +90,7 @@ class Array { /** * Create a new array that contains copies of all values. */ - Array(ArrayRef<T> values) + Array(Span<T> values) { m_size = values.size(); m_data = this->get_buffer_for_size(values.size()); @@ -100,7 +100,7 @@ class Array { /** * Create a new array that contains copies of all values. */ - Array(const std::initializer_list<T> &values) : Array(ArrayRef<T>(values)) + Array(const std::initializer_list<T> &values) : Array(Span<T>(values)) { } @@ -184,22 +184,22 @@ class Array { return *this; } - operator ArrayRef<T>() const + operator Span<T>() const { - return ArrayRef<T>(m_data, m_size); + return Span<T>(m_data, m_size); } - operator MutableArrayRef<T>() + operator MutableSpan<T>() { - return MutableArrayRef<T>(m_data, m_size); + return MutableSpan<T>(m_data, m_size); } - ArrayRef<T> as_ref() const + Span<T> as_span() const { return *this; } - MutableArrayRef<T> as_mutable_ref() + MutableSpan<T> as_mutable_span() { return *this; } @@ -243,9 +243,9 @@ class Array { /** * Copies the value to the given indices in the array. */ - void fill_indices(ArrayRef<uint> indices, const T &value) + void fill_indices(Span<uint> indices, const T &value) { - MutableArrayRef<T>(*this).fill_indices(indices, value); + MutableSpan<T>(*this).fill_indices(indices, value); } /** |