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

@ -61,6 +61,10 @@ TEST_CASE("[Span] Constexpr Validators") {
static_assert(span_string[0] == U'1');
static_assert(span_string[span_string.size() - 1] == U'5');
CHECK_EQ(span_string, span_string); // Same identity / ptr.
CHECK_EQ(span_string, Span(U"1223456", 6)); // Different ptr.
CHECK_EQ(span_string, Span("122345").reinterpret<uint8_t>()); // Different type.
int idx = 0;
for (const char32_t &chr : span_string) {
CHECK_EQ(chr, span_string[idx++]);