summaryrefslogtreecommitdiff
path: root/AK/Span.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-19 15:07:09 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-19 18:29:13 +0100
commit8e20208dd6d561f0891fd424d8c396c28247cff9 (patch)
tree633790ef5fca4c9a55e6e6805a54ab63b6e14ca1 /AK/Span.h
parent4d89c1885df4734c8b5cd61e1fd942dda24c3077 (diff)
downloadserenity-8e20208dd6d561f0891fd424d8c396c28247cff9.zip
LibTLS+LibCrypto: Replace a whole bunch of ByteBuffers with Spans
Diffstat (limited to 'AK/Span.h')
-rw-r--r--AK/Span.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/AK/Span.h b/AK/Span.h
index 870a2c5bca..f8d0028934 100644
--- a/AK/Span.h
+++ b/AK/Span.h
@@ -118,6 +118,9 @@ public:
ALWAYS_INLINE constexpr const T* data() const { return this->m_values; }
ALWAYS_INLINE constexpr T* data() { return this->m_values; }
+ ALWAYS_INLINE constexpr const T* offset_pointer(size_t offset) const { return this->m_values + offset; }
+ ALWAYS_INLINE constexpr T* offset_pointer(size_t offset) { return this->m_values + offset; }
+
using ConstIterator = SimpleIterator<const Span, const T>;
using Iterator = SimpleIterator<Span, T>;
@@ -128,7 +131,7 @@ public:
constexpr Iterator end() { return Iterator::end(*this); }
ALWAYS_INLINE constexpr size_t size() const { return this->m_size; }
-
+ ALWAYS_INLINE constexpr bool is_null() const { return this->m_values == nullptr; }
ALWAYS_INLINE constexpr bool is_empty() const { return this->m_size == 0; }
ALWAYS_INLINE constexpr Span slice(size_t start, size_t length) const