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-07-03 15:31:26 +0300
committerJacques Lucke <jacques@blender.org>2020-07-03 15:31:26 +0300
commit7704e6a678ab324b479797dc8d8f8d63b109956f (patch)
treea1ac8c05610c15aa6642b8f69b8c517533d7009b /source/blender/blenlib/BLI_vector_set.hh
parent395b294b614f43faac0ffaef167aed1b94a53b8e (diff)
Cleanup: bring operator overloads closer together
Diffstat (limited to 'source/blender/blenlib/BLI_vector_set.hh')
-rw-r--r--source/blender/blenlib/BLI_vector_set.hh50
1 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh
index 6d7fd101b65..2ee1113e221 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -236,6 +236,31 @@ class VectorSet {
}
/**
+ * Get the key stored at the given position in the vector.
+ */
+ const Key &operator[](uint32_t index) const
+ {
+ BLI_assert(index <= this->size());
+ return keys_[index];
+ }
+
+ operator Span<Key>() const
+ {
+ return Span<Key>(keys_, this->size());
+ }
+
+ /**
+ * 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.
+ */
+ Span<Key> as_span() const
+ {
+ return *this;
+ }
+
+ /**
* Add a new key to the vector set. This invokes undefined behavior when the key is in the set
* already. When you know for certain that a key is not in the set yet, use this method for
* better performance. This also expresses the intent better.
@@ -403,31 +428,6 @@ class VectorSet {
}
/**
- * Get the key stored at the given position in the vector.
- */
- const Key &operator[](uint32_t index) const
- {
- BLI_assert(index <= this->size());
- return keys_[index];
- }
-
- operator Span<Key>() const
- {
- return Span<Key>(keys_, this->size());
- }
-
- /**
- * 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.
- */
- Span<Key> as_span() const
- {
- return *this;
- }
-
- /**
* Print common statistics like size and collision count. This is useful for debugging purposes.
*/
void print_stats(StringRef name = "") const