c/c++
文章平均质量分 78
limwz
这个作者很懒,什么都没留下…
展开
-
简单实现vector
用operator new实现的Vector模板类,如下: #include #include #include using namespace std; class Test{ public: Test():data(10){ cout<<"Test()"<<endl; } Test(const Test& t):data(t.data){ cout<<"原创 2014-09-10 19:45:16 · 288 阅读 · 0 评论 -
简单实现auto_ptr,shared_ptr,weak_ptr
没有经过严格测试。 代码如下 Auto_ptr.h原创 2014-09-07 13:56:57 · 315 阅读 · 0 评论 -
多线程读写数据方法之读写锁方法与shared_ptr+互斥锁方法的比较
对共享资源进行多线程读写操作,一种原创 2014-09-04 18:52:30 · 1632 阅读 · 0 评论 -
一个简单地内存池
#include using namespace std; class MemPool{ private: typedef struct Node{ void* data; Node* next; }Node; Node* nodesHead_; Node* firstFree_; Node* usedNodes_; void* data; int原创 2014-09-21 15:22:02 · 266 阅读 · 0 评论 -
用c语言实现面向对象的封装继承和多态
#include #include using namespace std; struct Shape; typedef const string& (*GetName)(Shape* shape); typedef void (*Draw)(Shape* shape); typedef struct VTable{//虚表的定义 GetName getName; Dr原创 2014-09-07 09:38:51 · 379 阅读 · 0 评论