title: delete[] in destructor
body: <p>Well, I'm studying templates and, I have a problem with the next code:</p>
  
  <pre><code>        #include &lt;iostream&gt;
  
          using namespace std;
  
          template&lt;class T, int n&gt;
          class Table
          {
          public:
              Table();
              //~Table();
              int&amp; operator[](int i);
              bool Resize(int n);
              int Count();
              void Free();
  
          private:
              T* inst;
              int count;
          };
  
          template&lt;class T, int n&gt;
          Table&lt;T, n&gt;::Table()
          {
              inst = new T[n];
              count = n;
          }
  
          template&lt;class T, int n&gt;
          void Table&lt;T, n&gt;::Free()
          {
              delete[] this-&gt;inst;
          }
  
          template&lt;class T, int n&gt;
          int&amp; Table&lt;T, n&gt;::operator[](int i)
          {
              return inst[i];
          } 
  
          template&lt;class T, int n&gt;
          bool Table&lt;T, n&gt;::Resize(int n)
          {
              this-&gt;inst = (T*)realloc(this-&gt;inst, sizeof(T)*count + sizeof(T)*n);
              if(!inst)
                  return false;
  
              return true;
          }
  
          template&lt;class T, int n&gt;
          int Table&lt;T, n&gt;::Count()
          {
              return this-&gt;count;
          }
  
          template&lt;typename T, int n&gt; void ShowTable(Table&lt;T, n&gt; t)
          {
              for(int i=0; i&lt;t.Count(); i++)
                  cout&lt;&lt;t[i]&lt;&lt;endl;
          }
  
          int main()
          {
              Table&lt;int, 2&gt; table;
              table[0] = 23;
              table[1] = 150;
              ShowTable(table);
  
              system("pause");
              table.Free();
  
              return 0;
          }
  </code></pre>
  
  <p>It works but, when I put the <code>delete[] this-&gt;inst;</code> in the destructor, it throws me an Assertion Failed, and I don't know why... I mean, is it bad to delete resources in a destructor?</p>