append uninitialized elements to array

Steven Schveighoffer schveiguy at gmail.com
Mon Jul 30 19:24:08 UTC 2018


On 7/30/18 1:40 PM, realhet wrote:
> Hello,
> 
> I've already found out how to create an array with uninitialized 
> elements, but what I'm looking for is a way to append 16 uninitialized 
> ushorts to it and after I will it directly from 2 SSE registers.
> 
> The approximate array length is known at the start so I could be able to 
> do this by making an uninitializedArray and then doing the appending 
> manually, but I wonder if there is a way to do this with array.reserve().
> 
> Basically it would be a thing that when this special uninitialized 
> append is happening and when the reserved array size is big enough, it 
> only increments the internal array length effectively.
> 

There isn't an official way to do this. The function that extends the 
array always initializes. It's something that could potentially be an 
addition to druntime.

-Steve


More information about the Digitalmars-d-learn mailing list