第1年1月7日 unique_ptr
1.
void foo(std::unique_ptr<Entity>) { puts("Entering foo"); puts("Leaving foo"); } void ex2() { puts("--------"); puts("Entering ex2"); auto e1 = std::make_unique<Entity>(); foo(std::move(e1)); // e1 was destoried. puts("Leaving ex2"); }
https://www.bilibili.com/video/BV1fK411H7CA/?spm_id_from=333.788.recommend_more_video.3
https://zxi.mytechroad.com/blog/c/cpp-11-smart-pointers/