You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when serializing a vector, currently no check is done for the underlying type of the vector:
// Vector data typestemplate<typename T, typename A>
inlinevoidWrite(const std::vector<T, A>& vector) {
// Size calculation can't possibly overflow since the vector size necessarily fits in memoryWriteImplementation(vector.data(), vector.size() * sizeof(T));
}
This could potentially fail in bad ways for vectors of non-trivial types. We should add an appropriate enable_if guard on the vector's underlying type T, to ensure it is trivially-copyable.
In particular, this unguarded method should fail for std::vector<std::string> (unless the strings happen to all use the short-string optimization).
See the proposals in Issue #277 and Issue #278 for how we can serialize vectors of non-trivial types.
The text was updated successfully, but these errors were encountered:
For reference, the following
enable_if
check is used to only directly serialize trivial objects:However, when serializing a vector, currently no check is done for the underlying type of the vector:
This could potentially fail in bad ways for vectors of non-trivial types. We should add an appropriate
enable_if
guard on the vector's underlying typeT
, to ensure it is trivially-copyable.In particular, this unguarded method should fail for
std::vector<std::string>
(unless the strings happen to all use the short-string optimization).See the proposals in Issue #277 and Issue #278 for how we can serialize vectors of non-trivial types.
The text was updated successfully, but these errors were encountered: