01 2023 档案
摘要:循环引用会导致内存泄漏。看如下代码: #include <iostream> #include <memory> using namespace std; class CA; class CB; class CA { public: shared_ptr<CB> m_pb; ~CA() { cout
阅读全文
摘要:1. const char *p; 表示p指向的内容不能通过p来修改(p所指向的目标,那个目标中的内容不能通过p来修改)。因此,有人把p称为“常量指针”。 2. char const *p; “char const *p;”等价于“const char *p;”。 3. char * const p
阅读全文