From 6564f33eb324114407a1e59e7a4abb2f29026aa3 Mon Sep 17 00:00:00 2001 From: Eitan Traurig Date: Thu, 4 Sep 2025 20:44:01 +0200 Subject: [PATCH] Core: Add hashing support to Array data structure Implements hashing with the same implementation as the `Vector` data structure. Hashing requested in PR review of #145531. Pull Request: https://projects.blender.org/blender/blender/pulls/145689 --- source/blender/blenlib/BLI_array.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index dfa30777bc7..e7f2ac2dc43 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -355,6 +355,16 @@ class Array { return IndexRange(size_); } + uint64_t hash() const + { + return this->as_span().hash(); + } + + static uint64_t hash_as(const Span values) + { + return values.hash(); + } + friend bool operator==(const Array &a, const Array &b) { return a.as_span() == b.as_span();