title: What's the suited container to push values on top, remove at whatever index and avoid memory reallocation?
body: <p>I need to build a sort of stack where I can push values on top:</p>
  
  <pre><code>5      // (size 1)
  5 3    // (size 2)
  5 3 8  // (size 3)
  </code></pre>
  
  <p>than remove them by value, such as removing 3:</p>
  
  <pre><code>5 8    // (size 2)
  </code></pre>
  
  <p>than be able to always get the last value (i.e. 8 in the example), when I need it).</p>
  
  <p>I can push max 32 values, so I know the whole size (avoiding heap?).</p>
  
  <p>I think to <code>std::vector</code> with: </p>
  
  <ul>
  <li>initial reserve(32)</li>
  <li>.push_back() for insert</li>
  <li>vector.erase(std::remove(vector.begin(), vector.end(), value), vector.end()) for remove by value</li>
  <li>vector[vector.size() - 1] to retrieve the last element</li>
  </ul>
  
  <p>But maybe there are some stl container better for this kind of process? Not sure if vector are always in the stack and will do further memory reallocation under the hood...</p>