摘要: static static函数没有this pointer,static数据只有一份,static函数只能处理static数据。static数据在class外需要提供定义。 单例设计 class A{ public: static A& getInstance(); setup() {...} pr 阅读全文
posted @ 2023-08-22 15:25 stu--wy 阅读(39) 评论(0) 推荐(0)
摘要: Object Based:面对的是单一class的设计;Object Oriented:面对的是多重classes的设计,classes和classes之间的关系。 class 前向声明,声明,定义。 函数若在class body中定义完成,便自动成为inline函数。如果函数太复杂就不会成为inl 阅读全文
posted @ 2023-08-22 15:24 stu--wy 阅读(15) 评论(0) 推荐(0)
摘要: new的动作:默认调用全局operator new ,指针转型,构造。delete的动作:析构,然后默认调用全局operator delete。全局的operator new & 全局的operator delete 就是做malloc & free。如果operator new & operato 阅读全文
posted @ 2023-08-22 15:22 stu--wy 阅读(54) 评论(0) 推荐(0)
摘要: 设计主要目的:减少malloc的cookie的开销 设计主要方法:减少malloc的次数,用数据结构管理已经分配的内存。 核心数据结构:free_list[16]存储16根链表头,free_list[i],0~15 ,free_list[i]管理(i + 1)*16字节型区块。 客户所需要内存块大小 阅读全文
posted @ 2023-08-22 11:21 stu--wy 阅读(25) 评论(0) 推荐(0)