Will using a shared_ptr on class instance members clean up correctly when the owning object drops out of scope?
<p>will using a shared_ptr on class instance members clean up the new'ed objects correctly when the owning "parent" drops out of scope? Like in the example below?</p>

<p>Code example below - so when the Family instance goes out of scope will it clean up/delete the people objects linked to in the map?</p>

<p>If so how can i confirm this? Are there tools i can use to show before and after - after showing no person object - and if i put the normal pointers back i should still see the person objects - thanks</p>

<pre><code>class Family
{
private:
    //std::map&lt;int ,Person*&gt; _people;
    std::map&lt;int ,std::tr1::shared_ptr&lt;Person&gt;&gt; _people;

public:
    void AddPerson(int age)
    {
        //_people[age] = new Person(age);
        _people[age] = std::tr1::shared_ptr&lt;Person&gt;( new Person(age));
    }
};

    class Person
    {
    private:
        int _age;
    public: 
        Person(int age)
        {
            _age= age;
        }
        int GetName(){return _age;}
    };
</code></pre>
