util: do not use variable length array

vla (variable length array) is an extension in GCC and Clang. and
it is not part of the C++ standard.

so let's avoid using it if possible, for better standard compliant.
it's also more consistent with other places where we calculate the size
of an array of T in the same source file.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16084
This commit is contained in:
Kefu Chai
2023-11-17 17:56:48 +08:00
committed by Nadav Har'El
parent 0fd10690d4
commit 691f7f6edb

View File

@@ -34,7 +34,7 @@ private:
_backref->_data = _data;
}
size_t storage_size() const noexcept {
return sizeof(*this) + sizeof(T[_backref->_capacity]);
return sizeof(*this) + sizeof(T) * _backref->_capacity;
}
};
union maybe_constructed {