Problem about Tuple.opEquals, const qualifier

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 19 05:48:16 PDT 2012


On Sat, 17 Mar 2012 19:05:24 -0400, Simen Kjærås <simen.kjaras at gmail.com>  
wrote:

> As for a workaround, have you considered using a simple array instead of  
> a linked list?
> Arrays in D, especially when combined with std.array, make for  
> easy-to-use (though
> perhaps not particularly efficient) stacks:
>
> int[] stack;
>
> stack ~= 3; // Push
> stack = stack[0..$-1]; // Pop
> stack.popBack(); // Pop with std.array

stack.assumeSafeAppend();

You need that line, or the next append will reallocate the entire array.

-Steve


More information about the Digitalmars-d-learn mailing list