title: I made my own std::vector but I am generating an error
body: <p>Is there something wrong with the way that I allocated memory for <code>T* data</code> and also with my destructor? Mind you that <code>T* data</code> was already given to me as a private variable. I keep getting a segmentation fault error in my terminal. Also, I get the following warning:</p>
  
  <pre><code>unused variable 'data_' [-Wunused-variable] T* data_ = new T[size_];
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>public:
      // Define the iterator type to just be a pointer to T.
      typedef T* iterator;
  
      // Constructs an empty vector. Allocate an initial capacity of 1 element,
      // but do not add an element to the vector (i.e. capacity will be 1 while
      // size will be 0). You do not need to worry about bad_alloc exceptions.
      csc340_vector() {
          size_ = 0;
          capacity_ = 1;
          T* data_ = new T[size_];
      }
  
      // Destructs/de-allocates dynamic memory (if any was allocated).
      ~csc340_vector(){
         delete [] data_;
      }
  private:
      T* data_;                // Storage for the elements
      unsigned int size_;      // Number of elements defined in the vector
      unsigned int capacity_;  // Number of elements that the vector can hold
  
  };
  </code></pre>
  
  <p>Also, I have tried to use <code>T* data_ = new T[capacity_];</code> but it still generates the same unused variable warning.</p>