diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:31:26 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:31:26 +0300 |
commit | 7704e6a678ab324b479797dc8d8f8d63b109956f (patch) | |
tree | a1ac8c05610c15aa6642b8f69b8c517533d7009b /source/blender/blenlib/BLI_vector.hh | |
parent | 395b294b614f43faac0ffaef167aed1b94a53b8e (diff) |
Cleanup: bring operator overloads closer together
Diffstat (limited to 'source/blender/blenlib/BLI_vector.hh')
-rw-r--r-- | source/blender/blenlib/BLI_vector.hh | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index 1d161c419c8..50283d7b2b5 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -263,26 +263,6 @@ class Vector { } } - operator Span<T>() const - { - return Span<T>(begin_, this->size()); - } - - operator MutableSpan<T>() - { - return MutableSpan<T>(begin_, this->size()); - } - - Span<T> as_span() const - { - return *this; - } - - MutableSpan<T> as_mutable_span() - { - return *this; - } - Vector &operator=(const Vector &other) { if (this == &other) { @@ -310,6 +290,42 @@ class Vector { } /** + * Get the value at the given index. This invokes undefined behavior when the index is out of + * bounds. + */ + const T &operator[](uint index) const + { + BLI_assert(index < this->size()); + return begin_[index]; + } + + T &operator[](uint index) + { + BLI_assert(index < this->size()); + return begin_[index]; + } + + operator Span<T>() const + { + return Span<T>(begin_, this->size()); + } + + operator MutableSpan<T>() + { + return MutableSpan<T>(begin_, this->size()); + } + + Span<T> as_span() const + { + return *this; + } + + MutableSpan<T> as_mutable_span() + { + return *this; + } + + /** * Make sure that enough memory is allocated to hold min_capacity elements. * This won't necessarily make an allocation when min_capacity is small. * The actual size of the vector does not change. @@ -674,22 +690,6 @@ class Vector { } /** - * Get the value at the given index. This invokes undefined behavior when the index is out of - * bounds. - */ - const T &operator[](uint index) const - { - BLI_assert(index < this->size()); - return begin_[index]; - } - - T &operator[](uint index) - { - BLI_assert(index < this->size()); - return begin_[index]; - } - - /** * Get access to the underlying array. */ T *data() |