Listing 3: A container factory
struct keyComp { bool operator()(const char* key1,const char* key2) { return(strcmp(key1,key2)<0); } }; class containerMap: public map<char*,void*,keyComp,SharedAllocator<char* > > {}; class containerFactory { public: containerFactory():pool_(sizeof(containerMap)){} ~containerFactory() {} template<class Container> Container* createContainer (char* key,Container* c=NULL); template<class Container> Container* getContainer (char* key,Container* c=NULL); template<class Container> int removeContainer (char* key,Container* c=NULL); private: Pool pool_; int lock_(); int unlock_(); };