Problems with delete in destructor
<p>I wrote this code.<br>
The constructor works normally, but in the destructor I get "Windows has triggered a breakpoint." How should I correct this?</p>

<pre><code>template class CyclicalArray { 
private: 
   T* mem_ptr;
public: 
   CyclicalArray(size_t capacity, const T&amp; default_value) {
   this-&gt;default_value = default_value; 
   this-&gt;capacity = capacity; 
   head_index = 0; 
   mem_ptr = ::new T[capacity]; //memory allocating 
   for(T* p = mem_ptr; p &lt; mem_ptr + capacity * sizeof(T); p += sizeof(T)) { 
       ::new (p) T (default_value); //initialization 
   } 
} 
~CyclicalArray() { 
   for(T* p = mem_ptr + sizeof(T); p &lt; mem_ptr + capacity * sizeof(T); p += sizeof(T)) { 
      p-&gt;~T();
   } 
   delete[] mem_ptr; 
}
</code></pre>
