title: Alternatives of static_pointer_cast for unique_ptr
body: <p>I understand that using <code>static_pointer_cast</code> with <code>unique_ptr</code> would lead to a shared ownership of the contained data.<br>
  In other terms, what I'd like to do is:</p>
  
  <pre><code>unique_ptr&lt;Base&gt; foo = fooFactory();
  // do something for a while
  unique_ptr&lt;Derived&gt; bar = static_unique_pointer_cast&lt;Derived&gt;(foo);
  </code></pre>
  
  <p>Anyway doing that results with two <code>unique_ptr</code> that should never exist at the same time, so it is simply forbidden.<br>
  Right, it makes sense, absolutely, that's why there doesn't exist anything like <code>static_unique_pointer_cast</code> indeed.</p>
  
  <p>So far, in cases where I want to store pointers to those base classes, but I also need to cast them to some derived classes (as an example, imagine a scenario involving type erasure), I've used <code>shared_ptr</code>s because of what I've above mentioned.  </p>
  
  <p>Anyway, I was guessing if there are alternatives to <code>shared_ptr</code>s for such a problem or if they are really the best solution in that case.</p>