- support std::span in ByteBuffer
This commit is contained in:
@@ -53,6 +53,10 @@ ByteBuffer::ByteBuffer(const void* packetPtr, size_t packetSize, CopyBehavior be
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer::ByteBuffer(const std::span<const uint8_t>& packet, CopyBehavior behavior)
|
||||
: ByteBuffer(packet.data(), packet.size(), behavior)
|
||||
{}
|
||||
|
||||
ByteBuffer::~ByteBuffer()
|
||||
{
|
||||
if (mCopyBehavior == CopyBehavior::CopyMemory)
|
||||
@@ -105,6 +109,11 @@ uint8_t* ByteBuffer::mutableData()
|
||||
return mDataPtr;
|
||||
}
|
||||
|
||||
std::span<const uint8_t> ByteBuffer::span()
|
||||
{
|
||||
return {mDataPtr, mDataSize};
|
||||
}
|
||||
|
||||
NetworkAddress& ByteBuffer::remoteAddress()
|
||||
{
|
||||
return mRemoteAddress;
|
||||
|
||||
Reference in New Issue
Block a user