On 2017-08-29 19:35, Moritz Maxeiner wrote:

     void put(T t)
     {
         if (!store)
         {
             // Allocate only once for "small" vectors
             store = alloc.makeArray!T(8);
             if (!store) onOutOfMemoryError();
         }
         else if (length == store.length)
         {
             // Growth factor of 1.5
            auto expanded = alloc.expandArray!char(store, store.length / 2);
             if (!expanded) onOutOfMemoryError();
         }
         assert (length < store.length);
         moveEmplace(t, store[length++]);
     }

What's the reason to use "moveEmplace" instead of just assigning to the array: "store[length++] = t" ?

--
/Jacob Carlborg

Reply via email to