-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
newSeqUninitialized
over-constrained, setLenUninitialized
missing
#19727
Comments
ringabout
added a commit
that referenced
this issue
Sep 28, 2023
Araq
pushed a commit
that referenced
this issue
Sep 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
newSeqUninitialized
allows creatingseq
:s that are not initialized, for use as general-purpose buffers.It is however constrained to
SomeNumber
, which is unnecessarily restrictive: any type composed only of "trivial" types qualifies for this kind of treatment, similar to howcopyMem
is constrained to types thatsupportsCopyMem
.The above functionality is needed to create efficient serializers that preallocate memory then fill it with data from a source (disk/network/etc).
Growing a sequence uninitialized is needed likewise to reuse memory buffers in the above serializers - they do not have access to the capacity of the seq, so there is no way to write an optimal deserializer that reuses the existing capacity of a
seq
.The text was updated successfully, but these errors were encountered: