#include <iostream>
#include <memory>
#include <unordered_map>

class Test
{
    public:
        Test(){}
        ~Test(){}

        int test;
};

typedef std::shared_ptr<Test> Test_ptr;
typedef std::unordered_map<std::string, Test_ptr> TestMap;

int main()
{
    TestMap map1, map2;
    std::string key("abc");
    Test_ptr ptr(new Test);
    map1.insert(TestMap::value_type(key, ptr));

    TestMap::iterator iter = map1.find(key);
    if (iter != map1.end())
    {
        map2.insert(*iter);
        if (iter->second == nullptr)
        {
            std::cout << "after insert the shared ptr becomes null"  << std::endl;
        }
    }
}