forked from Bananymous/banan-os
BAN: ByteSpan can be sliced without specified size
This will give span with all remaining size after offset
This commit is contained in:
parent
6ee4d10651
commit
3566ddab00
|
@ -87,9 +87,12 @@ namespace BAN
|
||||||
return *reinterpret_cast<S*>(m_data);
|
return *reinterpret_cast<S*>(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteSpanGeneral slice(size_type offset, size_type length)
|
ByteSpanGeneral slice(size_type offset, size_type length = size_type(-1))
|
||||||
{
|
{
|
||||||
ASSERT(m_data);
|
ASSERT(m_data);
|
||||||
|
ASSERT(m_size >= offset);
|
||||||
|
if (length == size_type(-1))
|
||||||
|
length = m_size - offset;
|
||||||
ASSERT(m_size >= offset + length);
|
ASSERT(m_size >= offset + length);
|
||||||
return ByteSpanGeneral(m_data + offset, length);
|
return ByteSpanGeneral(m_data + offset, length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue