Serialisation: Add std::span wrappers for Recv_binary, Send_binary

pull/647/head
Jonathan G Rennison 3 months ago
parent 2208d70e33
commit bb627e944c

@ -78,9 +78,9 @@ struct BufferSerialisationHelper {
BufferSend_binary(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data, size);
}
void Send_binary(const byte *data, const byte *end)
void Send_binary(std::span<const byte> data)
{
this->Send_binary(data, end - data);
this->Send_binary(data.data(), data.size());
}
void Send_buffer(const byte *data, const size_t size)
@ -263,6 +263,15 @@ public:
pos += (decltype(pos)) size;
}
/**
* Reads binary data.
* @param buffer The buffer to put the data into.
*/
void Recv_binary(std::span<byte> buffer)
{
this->Recv_binary(buffer.data(), buffer.size());
}
/**
* Returns view of binary data.
* @param size The size of the data.

Loading…
Cancel
Save