`clear`ing a dynamic array

Olivier Pisano via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 25 01:29:53 PDT 2015


On Sunday, 25 October 2015 at 04:04:29 UTC, Shriramana Sharma 
wrote:
> rsw0x wrote:
>
>> use std.container.array
>
> Thanks all for all the recommendations. When would one use 
> std.array.appender with a built-in array vs 
> std.container.array.Array? What are the pros and cons on either 
> side?

Appender is a small wrapper that enables you to get an output 
range from a built-in array. It allocates using the GC. If you 
have an array and you need to pass it to a function that takes an 
output range, you can use it.

std.container.Array is a reference counted container that is 
equivalent to std::shared_ptr<std::vector<T>> in C++. It is not 
reliant on the GC.


More information about the Digitalmars-d-learn mailing list