util/{Const,Writable}Buffer: add static_assert to FromVoid()

This commit is contained in:
Max Kellermann 2017-11-10 19:43:17 +01:00
parent 49784513b1
commit 2670e13cbd
2 changed files with 2 additions and 0 deletions

View File

@ -144,6 +144,7 @@ struct ConstBuffer {
constexpr
#endif
static ConstBuffer<T> FromVoid(ConstBuffer<void> other) {
static_assert(sizeof(T) > 0, "Empty base type");
#ifndef NDEBUG
assert(other.size % sizeof(T) == 0);
#endif

View File

@ -138,6 +138,7 @@ struct WritableBuffer {
constexpr
#endif
static WritableBuffer<T> FromVoid(WritableBuffer<void> other) {
static_assert(sizeof(T) > 0, "Empty base type");
#ifndef NDEBUG
assert(other.size % sizeof(T) == 0);
#endif