title: C++ Pointers and Memory Deallocation
body: <p>I'm less used to rigid type-checking and lower level stuff such as deallocation. Recently, while attempting to write something along the lines of</p>
  
  <pre><code>// Product is a struct I defined earlier, nothing fancy
  vector&lt;string, Product&gt;::iterator it;
  // Do some stuff with the iterator...
  // And now I know I won't be using the iterator again
  map&lt;string, Product&gt;::iterator it;
  </code></pre>
  
  <p>However, this yielded the error 'duplicate declaration of local variable "it"'. So my question then is simply, why did this happen? I researched memory deconstruction, but so far as I'm aware it's apparently impossible to deconstruct iterators because they're actually pointers? Does C++ really not allow you to use the same name for different variables if you know you won't need the old one again, or normally would you release them into memory?</p>