util/{Const,Writable}Buffer: add static_assert to FromVoid()
This commit is contained in:
@@ -144,6 +144,7 @@ struct ConstBuffer {
|
|||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
static ConstBuffer<T> FromVoid(ConstBuffer<void> other) {
|
static ConstBuffer<T> FromVoid(ConstBuffer<void> other) {
|
||||||
|
static_assert(sizeof(T) > 0, "Empty base type");
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(other.size % sizeof(T) == 0);
|
assert(other.size % sizeof(T) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -138,6 +138,7 @@ struct WritableBuffer {
|
|||||||
constexpr
|
constexpr
|
||||||
#endif
|
#endif
|
||||||
static WritableBuffer<T> FromVoid(WritableBuffer<void> other) {
|
static WritableBuffer<T> FromVoid(WritableBuffer<void> other) {
|
||||||
|
static_assert(sizeof(T) > 0, "Empty base type");
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(other.size % sizeof(T) == 0);
|
assert(other.size % sizeof(T) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user