Repository: godotengine/godot
File: core/templates/vector.h (C/C++)

Code before:

	_FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); }
	_FORCE_INLINE_ const T *ptr() const { return _cowdata.ptr(); }
	_FORCE_INLINE_ Size size() const { return _cowdata.size(); }

	_FORCE_INLINE_ operator Span<T>() const { return _cowdata.span(); }
	_FORCE_INLINE_ Span<T> span() const { return _cowdata.span(); }

	_FORCE_INLINE_ void clear() { resize(0); }
	_FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); }

	_FORCE_INLINE_ T get(Size p_index) { return _cowdata.get(p_index); }
	_FORCE_INLINE_ const T &get(Size p_index) const { return _cowdata.get(p_index); }
	_FORCE_INLINE_ void set(Size p_index, const T &p_elem) { _cowdata.set(p_index, p_elem); }
	Error resize(Size p_size) { return _cowdata.resize(p_size); }
	Error resize_zeroed(Size p_size) { return _cowdata.template resize<true>(p_size); }
	_FORCE_INLINE_ const T &operator[](Size p_index) const { return _cowdata.get(p_index); }
	// Must take a copy instead of a reference (see GH-31736).
	Error insert(Size p_pos, T p_val) { return _cowdata.insert(p_pos, p_val); }
	Size find(const T &p_val, Size p_from = 0) const { return span().find(p_val, p_from); }
	Size find_seq(const Vector<T> &p_vector, Size p_from = 0) const { 
		if (p_from < 0) {
			return -1;
		}
		if (p_vector.size() == 0 || size() == 0 || p_vector.size() > size()) {
			return -1; // won't find anything!
		}
	
		if (p_vector.size() == 1){
			return span().find(p_vector[0], p_from);
		}

		return span().find_seq(p_vector.span(), p_from); 
	}
	Size rfind(const T &p_val, Size p_from = -1) const { return span().rfind(p_val, p_from); }
	Size rfind_seq(const Vector<T> &p_vector, Size p_from = 0) const {
		if (p_vector.size() == 0 || p_vector.size() > size()){
			return -1;
		}
	
		if (p_vector.size() == 1){
			return span().rfind(p_vector[0], p_from);
		}
	
		if (p_from < 0) {
			p_from = size() + p_from;
		}
		if (p_from < 0 || p_from >= size()) {
			p_from = size() - 1;
		}
		if (p_from > size() - p_vector.size()){

Review comment (suggestion):
I know you didn't write the comment, but this would be a good time to fix its spelling:
```suggestion
			return -1; // Won't find anything!
```

Code after:
	_FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); }
	_FORCE_INLINE_ const T *ptr() const { return _cowdata.ptr(); }
	_FORCE_INLINE_ Size size() const { return _cowdata.size(); }

	_FORCE_INLINE_ operator Span<T>() const { return _cowdata.span(); }
	_FORCE_INLINE_ Span<T> span() const { return _cowdata.span(); }

	_FORCE_INLINE_ void clear() { _cowdata.clear(); }
	_FORCE_INLINE_ bool is_empty() const { return _cowdata.is_empty(); }

	_FORCE_INLINE_ T get(Size p_index) { return _cowdata.get(p_index); }
	_FORCE_INLINE_ const T &get(Size p_index) const { return _cowdata.get(p_index); }
	_FORCE_INLINE_ void set(Size p_index, const T &p_elem) { _cowdata.set(p_index, p_elem); }

	/// Resize the vector.
	/// Elements are initialized (or not) depending on what the default C++ behavior for this type is.
	_FORCE_INLINE_ Error resize(Size p_size) {
		return _cowdata.template resize<!std::is_trivially_constructible_v<T>>(p_size);
	}

	/// Resize and set all values to 0 / false / nullptr.
	/// This is only available for zero constructible types.
	_FORCE_INLINE_ Error resize_initialized(Size p_size) {
		return _cowdata.template resize<true>(p_size);
	}

	/// Resize and set all values to 0 / false / nullptr.
	/// This is only available for trivially destructible types (otherwise, trivial resize might be UB).
	_FORCE_INLINE_ Error resize_uninitialized(Size p_size) {
		// resize() statically asserts that T is compatible, no need to do it ourselves.
		return _cowdata.template resize<false>(p_size);
	}

	_FORCE_INLINE_ const T &operator[](Size p_index) const { return _cowdata.get(p_index); }
	// Must take a copy instead of a reference (see GH-31736).
	Error insert(Size p_pos, T p_val) { return _cowdata.insert(p_pos, p_val); }
	Size find(const T &p_val, Size p_from = 0) const {
		if (p_from < 0) {
			p_from = size() + p_from;
		}
		if (p_from < 0 || p_from >= size()) {
			return -1;
		}
		return span().find(p_val, p_from);
	}
	Size rfind(const T &p_val, Size p_from = -1) const {
		if (p_from < 0) {
			p_from = size() + p_from;
		}
		if (p_from < 0 || p_from >= size()) {
			return -1;