title: Is there a way to fill a vector using an array?
body: <p>I'm trying to fill a vector with integers from an array I have but when I check the contents of the vector all the values are zero.</p>
  
  <p>I'm using vector.push_back() to try and fill the vector so it will be in the same order as the array as I needed it ordered in a specific way.</p>
  
  <pre><code>unsigned char* buffer = new unsigned char[size];
  std::vector&lt;unsigned char&gt; *data = new std::vector&lt;unsigned char&gt;(size);
  fread(buffer, sizeof(unsigned char), size, f);
  for(int transfer = 0; transfer &lt; size; transfer += 1){
      std::cout &lt;&lt; buffer[transfer];
      data-&gt;push_back(buffer[transfer]);
      std::cout &lt;&lt; int(data-&gt;at(transfer));
  }
  fclose(f);
  </code></pre>
  
  <p>When I print the output I can see that the values aren't zero when they're coming from the buffer array but they are when I read from the data vector. Here is some example output φ0$0.</p>