- 博客(4)
- 资源 (3)
- 收藏
- 关注
原创 对象引用计数
引用计数是为了节省空间的目的,在一个类A中,我们可以包含一个类B对象的指针,从而如果类A的不同实例都有同一的类B对象,那么这些实例中的B对象指针就可以指向同一个B对象. 下面是对象引用计数的一个粗略的实现,同时如果要达到引用计数的目的,必须有些限制条件.第1:类A必须有reference_count类的一个对象第2:要为char*的类型提供特化版本第3:要取得引用的对象,我们必须提供自己
2006-03-20 21:15:00 1141
原创 类实例个数的限制
#include #ifndef COUNT_HPP#define COUNT_HPP 1/*任何想用来限制自身对象数量的类可以继承此类 beCounted为该类名 size为计数尺寸 任何继承该类的实现中必须给最大计数初始化 例: template size base_count::maxObject=10; 注: 这个实现并不能解决多重继承计数的问题*/template class
2006-03-18 13:59:00 999
原创 简单的内存池模型
一个简单的针对原数据类型的内存池模型,纯粹为了练习下c++,没做特别的考虑.#include #include #include #ifndef POOL#define POOL 1//针对每一种原数据类型类型(或者是有trival构造函数的自定义类型),存在一个pooltemplate class pool{private: union node { Elem e;
2006-03-08 18:12:00 905
转载 C++中使用union的几点思考
这段时间整理旧资料,看到一些文章,虽然讲的都是些小问题,不大可能用到,但也算是一个知识点,特整理出来与大家共享。与此相关的那篇文章的作者的有些理解是错误的,我写此文,也是纠正为了作者的一些错误认识。当然,如果我的理解有任何错误,也恳请大家批评指正。 C++虽说被B.S.称作一门新语言,但它毕竟与C有着千丝万缕的联系,虽然B.S.一再坚持,但我还是愿意把C++看作是C ++。 我们应该按照C中的
2006-03-08 17:40:00 1052
java concurrency in practice.chm
2009-01-10
Domain-Driven Design: Tackling Complexity in the Heart of Software
2008-11-13
C99 standard
2008-10-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人