Array Appenders
Denis Koroskin
2korden at gmail.com
Tue Apr 7 12:42:12 PDT 2009
On Tue, 07 Apr 2009 17:24:07 +0400, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> Denis Koroskin wrote:
>> Well, actually I think that having an Appender object is an overkill. I
>> never use, although I wrote a few implementations. Instead, I found the
>> following method to be extemely handy, very fast and cover all my cases:
>> void append(T)(T[] array, ref size_t index, T value)
>> {
>> assert(array.length >= index);
>> if (array.length == index) {
>> array.length = array.length * 2;
>> }
>> array[index++] = value;
>> }
>
> I'm pretty sure you meant to pass array by reference.
>
>
> Andrei
Yes, of course!
More information about the Digitalmars-d
mailing list