title: Access violation while trying to read vector (C++)?
body: <p>I have been having a weird error that I can't quite figure out. I have created a vector that contains pointers to a custom class I made. The vector, however, shouldn't have any elements in it given that I don't push anything. When trying to loop through it (or simply call .size()), I get an access violation. Anyone know why this could be? Here is the code for reference:</p>
  
  <pre><code>void UserInterfaceManager::DrawWidgets(sf::RenderWindow* l_renderWindow)
  {
      std::cout &lt;&lt; m_uiWidgets.size();
      for (sf::Int16 i = 0; i &lt; static_cast&lt;sf::Int16&gt;(m_uiWidgets.size()); i++)
      {
          m_uiWidgets[i]-&gt;DisplayWidget(l_renderWindow);
      }
  }
  </code></pre>
  
  <p>Declaration of uiWidgets in UserInterfaceManager.h</p>
  
  <pre><code>std::vector&lt;UserInterfaceWidget*&gt; m_uiWidgets;
  </code></pre>
  
  <p>Thanks in advance!</p>