title: std::vector overwriting final value, rather than growing?
body: <p>I'm having an issue where using <code>vector.push_back(value)</code> is overwriting the final value, rather than appending to the end.  Why might this happen?  I have a sample item in the vector, so it's size never hits zero.  Below is the code..</p>
  
  <pre><code>void UpdateTable(vector&lt;MyStruct&gt; *Individuals, MyStruct entry)
  {
      MyStruct someEntry;
      bool isNewEntry = true;
  
      for (int i = 0; i &lt; Individuals-&gt;size(); i++)
      {
          if (!(strcmp(Individuals-&gt;at(i).sourceAddress, entry.sourceAddress)))
          {
              isNewEntry = false;
              //snip.  some work done here.
          }
      }
  
      if(isNewEntry)
      {
          Individuals-&gt;push_back(entry);
      }
  }
  </code></pre>
  
  <p>This let's my first "sample" value stay in, and will allow for just one more item in the vector.  When 2 new entries are added, the second overwrites the first, so the size is never larger than 2.</p>
  
  <p>edit:  More code, since this is apparently not the issue?</p>
  
  <pre><code>void *TableManagement(void *arg)
  {
        //NDP table to store discovered devices.
        //Filled with a row of sample data.
        vector&lt;MyStruct&gt; discoveryTable;
        MyStruct sample;
        sample.sourceAddress = "Sample";
        sample.lastSeen = -1;
        sample.beaconReceived = 1;
        discoveryTable.push_back(sample);
  
        srand(time(NULL));
        while(1)
        {
            int sleepTime = rand() % 3;
            sleep(sleepTime);
            MyStruct newDiscovery = ReceivedValue();
            if (newDiscovery.lastSeen != -1000) //no new value from receivedValue()
            {
                UpdateTable(&amp;discoveryTable, newDiscovery);
            }
            printTable(&amp;discoveryTable);
        }
        return NULL;
  }
  </code></pre>