From 7704e6a678ab324b479797dc8d8f8d63b109956f Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 3 Jul 2020 14:31:26 +0200 Subject: Cleanup: bring operator overloads closer together --- source/blender/blenlib/BLI_vector.hh | 72 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'source/blender/blenlib/BLI_vector.hh') 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() const - { - return Span(begin_, this->size()); - } - - operator MutableSpan() - { - return MutableSpan(begin_, this->size()); - } - - Span as_span() const - { - return *this; - } - - MutableSpan as_mutable_span() - { - return *this; - } - Vector &operator=(const Vector &other) { if (this == &other) { @@ -309,6 +289,42 @@ class Vector { return *this; } + /** + * 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() const + { + return Span(begin_, this->size()); + } + + operator MutableSpan() + { + return MutableSpan(begin_, this->size()); + } + + Span as_span() const + { + return *this; + } + + MutableSpan 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. @@ -673,22 +689,6 @@ class Vector { return this->first_index_of_try(value) != -1; } - /** - * 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. */ -- cgit v1.2.3