Fun with OpenAI

Steven Schveighoffer schveiguy at gmail.com
Tue Dec 20 03:53:46 UTC 2022


On 12/19/22 3:01 AM, Rumbu wrote:

> The std.array.array function allows you to create a fixed-size array 
> with a specified capacity, which means that the array will not need to 
> be reallocated or resized as you add elements to it. This can be useful 
> if you want to avoid using the garbage collector.

Hm... this sounds wrong. std.array.array allocates. And it definitely 
doesn't make a fixed-size array.

>      // Create an array with a capacity equal to the length of the string
>      auto substrings = array!string(s.length);

Not very correct ;)

-Steve


More information about the Digitalmars-d mailing list