title: Ada - Dynamically reallocate array
body: <p>I'm trying to write a stack based on array, that can be dynamically reallocated. The main problem I have is how to implement procedure that resizes the array. In C++ it could look like that:</p>
  
  <pre><code>template&lt;class T, int incr&gt;
  void Vector&lt;T, incr&gt;::inflate(int increase) {
      const int tsz = sizeof(T*);
      T** st = new T*[quantity + increase];
      memset(st, 0, (quantity + increase) * tsz);
      memcpy(st, storage, quantity * tsz);
      quantity += increase;
      delete []storage;
      storage = st;
  }
  </code></pre>
  
  <p>where <code>int quantity;</code> and <code>T** storage;</code> are declared in private section.</p>
  
  <p>If there is anyone who could share me some sample I'd be much grateful. I tried to look through the implementation of Ada.Containers.Vectors but argh... it's to big =P</p>
  
  <p>So far I've made this <a href="https://gist.github.com/496a50bc7f5cd93f8d91" rel="nofollow">Vector.ads</a> Can anyone help?</p>