title: vector.push_back is not resulting in the right value being pushed back
body: <p>I am practicing merge sort (for interview prep purposes). I am running into a very strange issue with vectors. It seems that pushing a certain value back onto the vector does not result in that value actually being put there. I could be missing something obvious, but I am not sure. Here is the code for the merge sort (some print statements were added in to understand what was going wrong)</p>
  
  <pre><code>void merge(std::vector&lt;int&gt; *vec, int low, int middle, int high) {
      printf("Entering Merge(%d, %d, %d)\n", low, middle, high);
      std::vector&lt;int&gt; helper;
      for(int i = low; i &lt;= high; ++i) {
          helper.push_back( (*vec)[i] );
      }
      std::cout &lt;&lt; "Array being worked on: [";
      for(auto &amp;p : helper) {
          std::cout &lt;&lt; p &lt;&lt; ", ";
      } std::cout &lt;&lt; "]" &lt;&lt; std::endl;
  
      int helperLeft = low, helperRight = middle + 1, vecIndex = low;
      while(helperLeft &lt;= middle &amp;&amp; helperRight &lt;= high) {
          if(helper[helperLeft] &lt;= helper[helperRight]) {
              (*vec)[vecIndex] = helper[helperLeft];
              ++helperLeft;
              std::cout &lt;&lt; "Helper Left: " &lt;&lt; helperLeft &lt;&lt; std::endl; 
          }
          else {
              (*vec)[vecIndex] = helper[helperRight];
              ++helperRight;
              std::cout &lt;&lt; "Helper Right: " &lt;&lt; helperRight &lt;&lt; std::endl;
          }
          ++vecIndex;
          std::cout &lt;&lt; "Current Index: " &lt;&lt; vecIndex   &lt;&lt; std::endl;
      }
  
      // Copy over the remaining elements into the array
      while(helperLeft &lt;= middle) {
          std::cout &lt;&lt; "Entered Left Remaining" &lt;&lt; std::endl;
          (*vec)[vecIndex] = helper[helperLeft];
          ++helperLeft;
          ++vecIndex;
      }
  
      while(helperRight &lt;= high) {
          std::cout &lt;&lt; "Entered Right Remaining" &lt;&lt; std::endl;
          (*vec)[vecIndex] = helper[helperRight];
          ++helperRight;
          ++vecIndex;
      }
      std::cout &lt;&lt; "Resulting Array: [";
      for(int i = low; i &lt; high; ++i) {
          std::cout &lt;&lt; (*vec)[i] &lt;&lt; ", ";
      } std::cout &lt;&lt; (*vec)[high] &lt;&lt; "]" &lt;&lt; std::endl;
      std::cout &lt;&lt; std::endl;
  }
  
  void mergeSort(std::vector&lt;int&gt; *vec, int low, int high) {
      if(low &lt; high) {
          int middle = (low + high) / 2;
          mergeSort(vec, low, middle);
          mergeSort(vec, middle + 1, high);
          merge(vec, low, middle, high);
      }
  }
  
  int main() {
      std::vector&lt;int&gt; array({2, 25, 1, 1, 5});
      mergeSort(&amp;array, 0, array.size() - 1);
  }
  </code></pre>