[swift-users] Set size of byte array

KS Sreeram ks at claylabs.com
Fri Aug 5 01:42:25 CDT 2016


I’m trying to initialize a byte-array efficiently with minimal copying with the following steps:

1. Create an empty byte array.
2. Reserve sufficient capacity in the array.
3. Use mutable pointers into the array to fill in the data.
4. The actual size that was filled is known only after it is filled in.
5. I would like to set the size of the array to the actual size.

I couldn’t find any methods for doing the last step. Is there a way to do this?

Thanks in advance!

KS Sreeram

More information about the swift-users mailing list