summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
Diffstat (limited to 'AK')
-rw-r--r--AK/Span.h2
-rw-r--r--AK/Tests/Span.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/AK/Span.h b/AK/Span.h
index d2258572e4..5fdcfce829 100644
--- a/AK/Span.h
+++ b/AK/Span.h
@@ -144,7 +144,7 @@ public:
ALWAYS_INLINE bool is_empty() const { return this->m_size == 0; }
- ALWAYS_INLINE Span<T> subspan(size_t start, size_t size) const
+ ALWAYS_INLINE Span slice(size_t start, size_t size) const
{
ASSERT(start + size <= this->m_size);
return { this->m_values + start, size };
diff --git a/AK/Tests/Span.cpp b/AK/Tests/Span.cpp
index 1eb0dd68de..53a70e12df 100644
--- a/AK/Tests/Span.cpp
+++ b/AK/Tests/Span.cpp
@@ -113,10 +113,10 @@ TEST_CASE(can_subspan_whole_span)
u8 buffer[16];
Bytes bytes { buffer, 16 };
- Bytes subspan = bytes.subspan(0, 16);
+ Bytes slice = bytes.slice(0, 16);
- EXPECT_EQ(subspan.data(), buffer);
- EXPECT_EQ(subspan.size(), 16u);
+ EXPECT_EQ(slice.data(), buffer);
+ EXPECT_EQ(slice.size(), 16u);
}
TEST_CASE(can_subspan_as_intended)
@@ -124,11 +124,11 @@ TEST_CASE(can_subspan_as_intended)
const u16 buffer[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
Span<const u16> span { buffer, 8 };
- auto subspan = span.subspan(3, 2);
+ auto slice = span.slice(3, 2);
- EXPECT_EQ(subspan.size(), 2u);
- EXPECT_EQ(subspan[0], 4);
- EXPECT_EQ(subspan[1], 5);
+ EXPECT_EQ(slice.size(), 2u);
+ EXPECT_EQ(slice[0], 4);
+ EXPECT_EQ(slice[1], 5);
}
TEST_CASE(span_from_void_pointer)