title: Dynamic casting for unique_ptr
body: <p>As it was the case in Boost, C++11 provides some functions for casting <code>shared_ptr</code>:</p>
  
  <pre><code>std::static_pointer_cast
  std::dynamic_pointer_cast
  std::const_pointer_cast
  </code></pre>
  
  <p>I am wondering, however, why there are no equivalents functions for <code>unique_ptr</code>.</p>
  
  <p>Consider the following simple example:</p>
  
  <pre><code>class A { virtual ~A(); ... }
  class B : public A { ... }
  
  unique_ptr&lt;A&gt; pA(new B(...));
  
  unique_ptr&lt;A&gt; qA = std::move(pA); // This is legal since there is no casting
  unique_ptr&lt;B&gt; pB = std::move(pA); // This is not legal
  
  // I would like to do something like:
  // (Of course, it is not valid, but that would be the idea)
  unique_ptr&lt;B&gt; pB = std::move(std::dynamic_pointer_cast&lt;B&gt;(pA));
  </code></pre>
  
  <p>Is there any reason why this usage pattern is discouraged, and thus, equivalent functions to the ones present in <code>shared_ptr</code> are not provided for <code>unique_ptr</code>?</p>