title: c++ container very efficient at adding elements to the end
body: <p>I have been running a c++ program for scientific purpose and I am now looking at optimizing it.</p>
  
  <p>The bottleneck seems to be a function where I need to stack pairs of integers. Their number is impossible to know from the start, and I have been using a <code>std::vector</code> of a custom struct holding two <code>ints</code>. Is there a more efficient data container for repetitively adding elements at the end? Should I use it with two <code>ints</code> instead of a pair or custom structure?</p>
  
  <p>edit:
  After timing and profiling my program, I can say that, for my use, <code>vector</code> is slightly faster than <code>deque</code> (by only 3%). My layman conclusion is that the CPU makes a good use of the contiguity of the data. Optimization is more than ever a sorcery for me! And to those it may help: I actually improved significantly my running time by switching from the STL C++ 11 random number generator to the BOOST one.</p>