Relax overly-strict assert in Serializer constructor (RIPD-1701):

The constructor would previously assert that the specified buffer pointer
was non-null, even if the buffer size is specified as 0. While reasonable,
this also makes it more difficult to use this API.
This commit is contained in:
Howard Hinnant
2018-12-05 11:28:53 -08:00
committed by Nik Bougalis
parent 76d5ecb595
commit 710f9ee1ac

View File

@@ -51,12 +51,13 @@ public:
Serializer (void const* data, std::size_t size)
{
assert(!data == !size);
mData.resize(size);
if (size)
{
assert(data != nullptr);
std::memcpy(mData.data(), data, size);
}
}
Slice slice() const noexcept