What's a fast way to insert an element at index 0 of array? now that the code is working I want to clean this:

void push(T val)
        {
                T[] t = new T[buffer.length + 1];
                t[0] = val;
                t[1 .. $] = buffer;
                buffer = t;
        }

I did this because I didn't find any suble built-in data structure that let me insert an item into a specific index at first search. Slist does have insertFron(), exactly what I'm looking for it's a linked list.

Reply via email to