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/intern | |
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/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_index_range.cc | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/dot_export.cc | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/BLI_index_range.cc b/source/blender/blenlib/intern/BLI_index_range.cc index 31b969ec0b3..910e418a29b 100644 --- a/source/blender/blenlib/intern/BLI_index_range.cc +++ b/source/blender/blenlib/intern/BLI_index_range.cc @@ -18,8 +18,8 @@ #include <mutex> #include "BLI_array.hh" -#include "BLI_array_ref.hh" #include "BLI_index_range.hh" +#include "BLI_span.hh" #include "BLI_vector.hh" namespace blender { @@ -29,18 +29,18 @@ static uint current_array_size = 0; static uint *current_array = nullptr; static std::mutex current_array_mutex; -ArrayRef<uint> IndexRange::as_array_ref() const +Span<uint> IndexRange::as_span() const { uint min_required_size = m_start + m_size; if (min_required_size <= current_array_size) { - return ArrayRef<uint>(current_array + m_start, m_size); + return Span<uint>(current_array + m_start, m_size); } std::lock_guard<std::mutex> lock(current_array_mutex); if (min_required_size <= current_array_size) { - return ArrayRef<uint>(current_array + m_start, m_size); + return Span<uint>(current_array + m_start, m_size); } uint new_size = std::max<uint>(1000, power_of_2_max_u(min_required_size)); @@ -54,7 +54,7 @@ ArrayRef<uint> IndexRange::as_array_ref() const std::atomic_thread_fence(std::memory_order_seq_cst); current_array_size = new_size; - return ArrayRef<uint>(current_array + m_start, m_size); + return Span<uint>(current_array + m_start, m_size); } } // namespace blender diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc index f08fb02ec21..a2cf843c473 100644 --- a/source/blender/blenlib/intern/dot_export.cc +++ b/source/blender/blenlib/intern/dot_export.cc @@ -250,8 +250,8 @@ std::string color_attr_from_hsv(float h, float s, float v) NodeWithSocketsRef::NodeWithSocketsRef(Node &node, StringRef name, - ArrayRef<std::string> input_names, - ArrayRef<std::string> output_names) + Span<std::string> input_names, + Span<std::string> output_names) : m_node(&node) { std::stringstream ss; |