對象池只是管理指針和對象用的,並不高效
#include <stdio.h><.h><unistd.h><map><pthread.h><list><vector><queue> * process(* i=( *j = *j = *++(i % == <,>( i=;i<;i++= j=(std::map<,>::iterator iter =!=++->->i = ->~<> cc[< CObject> *c =( i=;i<;i++= ->~ pop(CObject *&(!->= ->->( i = ; i < ; i++* c = -> push(CObject *-><CObject*>< CObject> *c =( i=;i<;i++= ->~ pop(CObject *&(!->= ->->( i = ; i < ; i++* c = -> push(CObject *-><CObject*> main( argc,*<TestObject> start =<TestObject*>( i=;i<;i++* p = (std::list<TestObject*>::iterator iter = _list.begin() ; iter != _list.end() ; iter ++ delete * end =,(end -
有興趣的同學可以測試下上面的代碼!
stl的vector 和 queue 相對高效,比list快不少,用vector和queue 維護的對象池,已經和裸指針管理性能相當。