Is it correct to return null shared_ptr? : <p>For example, there is a function that finds an object and returns shared_ptr if object is found, and must indicate somehow that no object was found.</p>

<pre><code>std::vector&lt;std::shared_ptr&gt; Storage::objects;

std::shared_ptr&lt;Object&gt; Storage::findObject()
{
  if (objects.find)
  {
    return objects[x];
  }
  else
  {
    return nullptr;
  }
}

std::shared_ptr&lt;Object&gt; obj = Storage::findObject();
if (obj)
{
  print("found");
}
else
{
  print("not found");
}
</code></pre>

<ol>
<li><p>Is it correct to return shared_ptr implicitly initialized with nullptr like in upper example? It will work, but can be it done this way? Or should I return shared_ptr default constructed instead?</p></li>
<li><p>What in case it would be weak_ptr? What is proper way to check that empty weak_ptr has been returned? by weak_ptr::expired function or are there other ways? If checking by weak_ptr::expired is the only way then how can I distinguish that function returned empty pointer, or object was just deleted(multi-thread environment)?</p></li>
</ol>
