mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
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:
parent
ef34c3d534
commit
d7f5c13db8
5 changed files with 44 additions and 98 deletions
|
|
@ -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++]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue