title: Conditions for deletion of an std::shared_ptr
body: <p>Lets say I have the following:</p>
  
  <pre><code>class Bar
  {
      public:
          int i;
  };
  
  class Foo
  {
      public:
          std::vector&lt;std::shared_ptr&lt;Bar&gt;&gt; vector;
  };
  
  class FooBar
  {
      public:
          std::shared_ptr&lt;Bar&gt; myBar;
  };
  
  int main()
  {
      Foo foo;
      FooBar foobar;
  
      foobar.myBar = std::make_shared&lt;Bar&gt;();
  
      foo.vector.push_back(foobar.myBar);
  
      foobar.myBar = nullptr;
  }
  </code></pre>
  
  <p>Does both myBar and foo.vector.back() equal nullptr? Have they both been deleted? What would be the right way to do this? My endgoal is to be able to have a vector of pointers to objects, construct objects and put them into that vector from a different scope, then in the scope they were created in delete them and have them removed from the vector. My thought process is if I can somehow delete all instances of the pointer easily then I can just do a check each frame to remove the shared_ptr from the vector if it equals nullptr.</p>