-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unpacking of containers default-constructs elements rather than using reconstruction logic #161
Comments
I believe that the scrupulously correct strategy for types that should be treated with this care is to reserve sufficient capacity (see #162) , and then reconstruct elements one at a time, using calls to
However, that
Where that latter function is defined to come up with arguments of the same type as reconstruction does now, and pass them to the lambda it receives, rather than to an object constructor. |
We already have classes ( |
My point was more that the container serializers uniformly don't call |
suggested test case: use vector of a class with default constructor deleted |
…containers-elements #161 use reconstruction logic for std::vector
For
std::vector<T> v
, the current code callss | len; v.resize(len)
, which results in calling the default constructorT::T()
. This may not be valid code at all, for some types. For other types, the default constructor could be needlessly expensive. This violates the usual stated contract serialization offers, that reconstruction should use a tagged constructor if one is defined.The text was updated successfully, but these errors were encountered: