mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 19:46:03 +00:00
AK: Allow comparing spans of different constness
Otherwise, the following code would not compile: constexpr Array<int, 3> array { 4, 5, 6 }; Vector<int> vector { 4, 5, 6 }; if (array == vector.span()) { } We do such comparisons in tests quite a bit. But it currently doesn't become an issue because of the way EXPECT_EQ copies its input parameters to non-const locals. In a future patch, that copying will be removed, and the compiler would otherwise complain about not finding a suitable comparison operator.
This commit is contained in:
parent
c9caa4262e
commit
831e5ed4e2
Notes:
github-actions[bot]
2024-08-13 12:14:06 +00:00
Author: https://github.com/trflynn89
Commit: 831e5ed4e2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1041
2 changed files with 14 additions and 0 deletions
|
@ -159,3 +159,11 @@ TEST_CASE(contains_slow)
|
|||
EXPECT(!span.contains_slow(String {}));
|
||||
EXPECT(!span.contains_slow(StringView {}));
|
||||
}
|
||||
|
||||
TEST_CASE(compare_different_constness)
|
||||
{
|
||||
constexpr Array<int, 3> array { 4, 5, 6 };
|
||||
Vector<int> vector { 4, 5, 6 };
|
||||
|
||||
EXPECT_EQ(array, vector.span());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue