title: How do I insert queue elements into a vector?
body: <p>I have </p>
  
  <pre><code>typedef std::queue&lt;MyObject*&gt; InputQueue;
  std::vector&lt;InputQueue&gt; inp_queue;
  </code></pre>
  
  <p>Now what I want to do is define at runtime say 5 queues and place data on those queues like</p>
  
  <pre><code>inp_queue[1].push(new MyObject());
  </code></pre>
  
  <p>etc.</p>
  
  <p>I got it to compile, but it core dumps right away.  I guess I need to actually add the queues to the vector first (they don't get created automatically like a map).  How do I add a queue without it being a pointer to a queue?</p>
  
  <p>EDIT:</p>
  
  <p>I should really have pointed out that the queue class I am using is not std::queue but this one: <a href="http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html" rel="nofollow">http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html</a></p>
  
  <p>I didn't expect the compiler to complain about it otherwise I would have stated it up front.</p>
  
  <p>Unfortunately when I compile the application I get this compilation error.</p>
  
  <pre><code>g++ test.cpp
  In file included from /usr/include/c++/4.4/deque:63,
                   from /usr/include/c++/4.4/queue:61,
                   from concurrentqueue.h:3,
                   from test.cpp:1:
  /usr/include/c++/4.4/bits/stl_construct.h: In function ‘void std::_Construct(_T1*, const _T2&amp;) [with _T1 = concurrent_queue&lt;Packet*&gt;, _T2 = concurrent_queue&lt;Packet*&gt;]’:
  /usr/include/c++/4.4/bits/stl_uninitialized.h:187:   instantiated from ‘static void std::__uninitialized_fill_n&lt;&lt;anonymous&gt; &gt;::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&amp;) [with _ForwardIterator = concurrent_queue&lt;Packet*&gt;*, _Size = long unsigned int, _Tp = concurrent_queue&lt;Packet*&gt;, bool &lt;anonymous&gt; = false]’
  /usr/include/c++/4.4/bits/stl_uninitialized.h:223:   instantiated from ‘void std::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&amp;) [with _ForwardIterator = concurrent_queue&lt;Packet*&gt;*, _Size = long unsigned int, _Tp = concurrent_queue&lt;Packet*&gt;]’
  /usr/include/c++/4.4/bits/stl_uninitialized.h:318:   instantiated from ‘void std::__uninitialized_fill_n_a(_ForwardIterator, _Size, const _Tp&amp;, std::allocator&lt;_Tp2&gt;&amp;) [with _ForwardIterator = concurrent_queue&lt;Packet*&gt;*, _Size = long unsigned int, _Tp = concurrent_queue&lt;Packet*&gt;, _Tp2 = concurrent_queue&lt;Packet*&gt;]’
  /usr/include/c++/4.4/bits/stl_vector.h:1035:   instantiated from ‘void std::vector&lt;_Tp, _Alloc&gt;::_M_fill_initialize(size_t, const _Tp&amp;) [with _Tp = concurrent_queue&lt;Packet*&gt;, _Alloc = std::allocator&lt;concurrent_queue&lt;Packet*&gt; &gt;]’
  /usr/include/c++/4.4/bits/stl_vector.h:230:   instantiated from ‘std::vector&lt;_Tp, _Alloc&gt;::vector(size_t, const _Tp&amp;, const _Alloc&amp;) [with _Tp = concurrent_queue&lt;Packet*&gt;, _Alloc = std::allocator&lt;concurrent_queue&lt;Packet*&gt; &gt;]’
  test.cpp:18:   instantiated from here
  /usr/include/c++/4.4/bits/stl_construct.h:74: error: no matching function for call to ‘concurrent_queue&lt;Packet*&gt;::concurrent_queue(const concurrent_queue&lt;Packet*&gt;&amp;)’
  concurrentqueue.h:12: note: candidates are: concurrent_queue&lt;Packet*&gt;::concurrent_queue()
  concurrentqueue.h:12: note:                 concurrent_queue&lt;Packet*&gt;::concurrent_queue(concurrent_queue&lt;Packet*&gt;&amp;)
  </code></pre>