title: c++ STL using vector<SafeList> resize failed
body: <p>I defined a ThreadSafe List and I want to declear a vector to save some ThreadSafe list, but when I initialized the vector using resize, I got some error.</p>
  <p>The SafeList I defined:</p>
  <pre><code>template&lt;class T&gt;
  class SafeQueue{
  public:
      SafeQueue() {}
      SafeQueue(const SafeQueue &amp; sq) = delete;
      SafeQueue &amp; operator = (const SafeQueue &amp; sq) = delete;
  
  private:
      std::queue&lt;T&gt; queue_;
      std::mutex mutex_;
  </code></pre>
  <p>And the Initialization code is:</p>
  <pre class="lang-cpp prettyprint-override"><code>for (auto &amp; p : timer_) {
      // p type: std::vector&lt;SafeContainer::SafeList&lt;TimerNodePtr&gt; &gt;
      p.resize(SHIFT);
  }
  </code></pre>
  <p>And the error information followed:</p>
  <pre><code>/usr/include/c++/9/bits/stl_uninitialized.h: In instantiation of ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator&lt;SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*&gt;; _ForwardIterator = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*]’:
  /usr/include/c++/9/bits/stl_uninitialized.h:307:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator&lt;_Tp&gt;&amp;) [with _InputIterator = std::move_iterator&lt;SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*&gt;; _ForwardIterator = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*; _Tp = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;]’
  /usr/include/c++/9/bits/stl_uninitialized.h:329:2:   required from ‘_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&amp;) [with _InputIterator = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*; _ForwardIterator = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;*; _Allocator = std::allocator&lt;SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt; &gt;]’
  /usr/include/c++/9/bits/vector.tcc:659:48:   required from ‘void std::vector&lt;_Tp, _Alloc&gt;::_M_default_append(std::vector&lt;_Tp, _Alloc&gt;::size_type) [with _Tp = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;; _Alloc = std::allocator&lt;SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt; &gt;; std::vector&lt;_Tp, _Alloc&gt;::size_type = long unsigned int]’
  /usr/include/c++/9/bits/stl_vector.h:937:4:   required from ‘void std::vector&lt;_Tp, _Alloc&gt;::resize(std::vector&lt;_Tp, _Alloc&gt;::size_type) [with _Tp = SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt;; _Alloc = std::allocator&lt;SafeContainer::SafeList&lt;std::shared_ptr&lt;Timer::TimerNode&gt; &gt; &gt;; std::vector&lt;_Tp, _Alloc&gt;::size_type = long unsigned int]’
  /home/ctrlz/workSpace/MyServer/src/Timer.cpp:8:23:   required from here
  /usr/include/c++/9/bits/stl_uninitialized.h:127:72: error: static assertion failed: result type must be constructible from value type of input range
    127 |       static_assert(is_constructible&lt;_ValueType2, decltype(*__first)&gt;::value,
  </code></pre>
  <p>Can someone help me? Thanks!</p>
  <hr />
  <p>minimal reproducible example as followed:</p>
  <pre><code>#include &lt;vector&gt;
  #include &lt;queue&gt;
  #include &lt;mutex&gt;
  template&lt;class T&gt;
  class SafeQueue{
  public:
      SafeQueue() {}
      SafeQueue(const SafeQueue &amp; sq) = delete;
      SafeQueue &amp; operator = (const SafeQueue &amp; sq) = delete;
  
  
  private:
      std::queue&lt;T&gt; queue_;
      std::mutex mutex_;
  };
  
  int main() {
      std::vector&lt;SafeQueue&lt;int&gt; &gt; list;
      list.resize(5);
  }
  </code></pre>