title: shared_ptr and raw pointer to the same type in ternary operator
body: <p>I have a statement which uses a ternary operator which looks like this:</p>
  
  <pre><code>auto res = (test) ? test : func();
  </code></pre>
  
  <p>where test is a raw pointer to an element of type T while <code>func()</code> is a function which returns a <code>shared_ptr</code> to that type T, i.e. <code>shared_ptr&lt;T&gt;</code>.</p>
  
  <p>The C++ compiler complains that as it is, this is not correct as they are two different types, so to make it work I am doing something like this <code>func().get()</code>, but I was wondering, what is the best way idiomatically in C++ to write that statement?</p>