title: convert deque or LIFO container to std::vector
body: <p>I have the following use case:</p>
  
  <ul>
  <li><code>containerTypeX</code> object to which I insert many elements at the front</li>
  <li>After the <code>containerTypeX</code> object has everything inserted, the <code>containerXType</code> object needs to be converted to a <code>std::vector</code></li>
  </ul>
  
  <p>For <code>containerTypeX</code> I chose <code>std::deque</code> over <code>std::vector</code>, because as far as I know inserting at the begin of a <code>std::vector</code> is not efficient.
  But now I have to convert the <code>std::deque</code> to a <code>std::vector</code> and do not want to move every single element from the queue to the vector separately like</p>
  
  <pre><code>v.emplace_back(std::move(q.front()));
  </code></pre>
  
  <p>1) Is there a way to directly convert my queue to a vector that I am missing?</p>
  
  <p>2) Should I use a LIFO container like <code>std::stack</code> instead of <code>std::deque</code> as I am only inserting one one side? But this will leave me the problem that in addition the element ordering needs to be reversed when converted to the <code>std::vector</code>...</p>
  
  <p>Related Question: <a href="https://stackoverflow.com/questions/38699268/how-to-convert-stdqueue-to-stdvector">How to convert std::queue to std::vector</a></p>