Add Span equality (== and !=) operators.

Exchange duplicate equality iteration implementations across `Vector` and `String` with the `Span` version, for a speed boost.
This commit is contained in:
Lukas Tenbrink 2025-11-15 13:44:50 +01:00
parent ef34c3d534
commit d7f5c13db8
5 changed files with 44 additions and 98 deletions

View file

@ -211,12 +211,7 @@ public:
_FORCE_INLINE_ CharStringT(const T *p_cstr) { copy_from(p_cstr); }
_FORCE_INLINE_ void operator=(const T *p_cstr) { copy_from(p_cstr); }
_FORCE_INLINE_ bool operator==(const CharStringT<T> &p_other) const {
if (length() != p_other.length()) {
return false;
}
return memcmp(ptr(), p_other.ptr(), length() * sizeof(T)) == 0;
}
_FORCE_INLINE_ bool operator==(const CharStringT<T> &p_other) const { return span() == p_other.span(); }
_FORCE_INLINE_ bool operator!=(const CharStringT<T> &p_other) const { return !(*this == p_other); }
_FORCE_INLINE_ bool operator<(const CharStringT<T> &p_other) const {
if (length() == 0) {