title: C++ - Boost.Promise, Boost.Unique_Future and Move Semantics
body: <p>I'm following some tutorials by Bartosz Milewski <a href="http://www.corensic.com/Learn/Resources/ConcurrencyTutorialPartFour.aspx" rel="nofollow">here</a> which I find very useful.
  However, as the author uses the <a href="http://www.stdthread.co.uk/" rel="nofollow">just::thread</a> implementation of the C++11 threading standard (which I don't yet have), I have decided to go with boost threads for now as the author of the tutorial says its trivial to do so. This seems to be the case for the first three tutorials in the series but I bumped into some problems with the fourth. Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cassert&gt;
  #include &lt;boost\thread.hpp&gt;
  #include &lt;boost\thread\future.hpp&gt;
  
  void thFun(boost::promise&lt;std::string&gt; &amp; prms)
  {
      std::string str("Hi from future!");
      prms.set_value(str);
  }
  
  int main()
  {
      boost::promise&lt;std::string&gt; prms;
      boost::unique_future&lt;std::string&gt; fut = prms.get_future();
  
      boost::thread th(&amp;thFun, std::move(prms)); // error C2248: 'boost::promise&lt;R&gt;::promise' : cannot access private member declared in class 'boost::promise&lt;R&gt;' 
  
      std::cout &lt;&lt; "Hi from main!";
      std::string str = fut.get();
      std::cout &lt;&lt; str &lt;&lt; std::endl;
      th.join();
  
      return 0;
  }
  </code></pre>
  
  <p>The following line seems to raise an issue that I don't understand:</p>
  
  <pre><code>boost::thread th(&amp;thFun, std::move(prms));
  </code></pre>
  
  <p>where the compiler complains: </p>
  
  <blockquote>
    <p>error C2248: 'boost::promise::promise' : cannot access private
    member declared in class 'boost::promise'</p>
  </blockquote>
  
  <p>Can anyone suggest what the problem might be?</p>
  
  <p>thanks in advance!</p>