title: Trying to pass contents of a vector to a thread
body: <p>I have a function that takes a vector of strings, and I have a series of those string vectors in a vector.</p>
  
  <p>I wanted to loop through the vector passing each vector of strings to a new thread.</p>
  
  <pre><code>for (vector&lt;vector&lt;string&gt; &gt;::iterator it = vecstringvec.begin() ; 
       it != vecstringvec.end(); ++it){
      threadvector.push_back(thread(func, *it));
  }
  </code></pre>
  
  <p>Essentially the above, except the above doesn't work (compile error). What I believe is that I need a std::ref of the vector to pass along, but I'm not sure exactly, or how to do that using the iterator.</p>
  
  <p>full error:</p>
  
  <pre><code>/usr/include/c++/4.8/functional: In instantiation of ‘struct std::_Bind_simple&lt;void (*(std::vector&lt;std::basic_string&lt;char&gt; &gt;, std::reference_wrapper&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;))(std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;)&gt;’:
  /usr/include/c++/4.8/thread:137:47:   required from ‘std::thread::thread(_Callable&amp;&amp;, _Args&amp;&amp; ...) [with _Callable = void (&amp;)(std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;); _Args = {std::vector&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt;&amp;, std::reference_wrapper&lt;std::vector&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;}]’
  prog.cpp:199:55:   required from here
  /usr/include/c++/4.8/functional:1697:61: error: no type named ‘type’ in ‘class std::result_of&lt;void (*(std::vector&lt;std::basic_string&lt;char&gt; &gt;, std::reference_wrapper&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;))(std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;)&gt;’
         typedef typename result_of&lt;_Callable(_Args...)&gt;::type result_type;
                                                               ^
  /usr/include/c++/4.8/functional:1727:9: error: no type named ‘type’ in ‘class std::result_of&lt;void (*(std::vector&lt;std::basic_string&lt;char&gt; &gt;, std::reference_wrapper&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;))(std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;)&gt;’
           _M_invoke(_Index_tuple&lt;_Indices...&gt;)
           ^
  make: *** [prog.o] Error 1
  </code></pre>