#include #include #include struct User { int id = 30; std::string name = "steph"; }; struct NodeS { std::shared_ptr next; int value; }; int main() { std::shared_ptr sp_empty; std::shared_ptr sp_int = std::make_shared(10); std::shared_ptr sp_str = std::make_shared("hello"); std::shared_ptr &sp_int_ref = sp_int; std::shared_ptr &&sp_int_ref_ref = std::make_shared(10); std::shared_ptr sp_user = std::make_shared(); std::shared_ptr ptr_node = std::shared_ptr(new NodeS{nullptr, 2}); ptr_node = std::shared_ptr(new NodeS{std::move(ptr_node), 1}); // Construct empty shared_ptr with non-null control field. std::shared_ptr si(new int(47)); std::shared_ptr sie(si, nullptr); std::puts("// break here"); std::weak_ptr wie = sie; std::weak_ptr wie2 = sie; std::puts("// break here"); return 0; }