C++ 智能指针:高级用法和注意事项 C++ 智能指针:高级用法和注意事项 高级用法: 1. 自定义智能指针: 可以创建自己的智能指针,继承自 std::unique_ptr 或 std::shared_ptr,为特定需求定制行为。 class CustomPtr : public std::unique_ptr { public: CustomPtr(int* ptr) : std::unique_ptr(ptr) {} ~Cust 开发运维 2024-05-09 竹子爱熊猫