title: Thread function with passed by reference vector is slow to start
body: <p>I've been looking at C++0x threads and have this code:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;thread&gt;
  void TestFunc(const vector&lt;int&gt;&amp; vVec)
  {
      cout &lt;&lt; "in"&lt;&lt;endl;
  }
  
  int main()
  {
  
      int sizer = 400000000;
  
      vector&lt;int&gt; vTest(sizer);
      for(int f=0; f&lt;sizer; f++)
          vTest[f] = f;
  
  
     cout &lt;&lt; "V created." &lt;&lt; endl;
  
     thread one(TestFunc, vTest);
  
       one.join();    
  
  }
  </code></pre>
  
  <p>As you can see it just passes a vector to a thread.
  The thing I don't understand is that there is a pause after the message "V created" appears. Originally this (I assumed) was the vector being copied for use in the function.
  To stop this I passed by reference instead but this made no difference. </p>
  
  <p>The delay seems to be proportional to the size of the vector which indicates that it is still copying (or doing something with the array).
  If I try the same experiment without threads and just call the function directly the delay is there when passing by value but not when passing by reference as I expected.</p>
  
  <p>I tried the same using Boost threads instead of C++0x (even though I've read that they are much the same) and got the same result.</p>
  
  <p>Is there some reason for this behaviour or have I missed something blindingly obvious?
  Thanks.</p>
  
  <p>Sorry, posted the wrong test code. Corrected.
  Edit: Added includes as requested.</p>
  
  <p>Compiled with:
  g++44 -std=c++0x -lpthread tester.cpp -o test
  ...as I have GNU 4.4 installed along side the standard GNU compiler that comes with my Linux (CentOS) which doesn't support C++11.</p>