std::cout << "-------------1" << std::endl; v.pop_back(); // sub_test pop out std::cout << "-------------2" << std::endl; v.pop_back(); // test pop out std::cout << "-------------3" << std::endl;
// output At begin of main. creating std::vector<std::shared_ptr<void>> Creating test Test created Test created sub_test created Leaving scope -------------1 sub_test destroyed Test destroyed -------------2 Test destroyed -------------3 Leaving main