自行设计的管理器

/* 02.15.2009 [email protected] www.gaimo.net */ #ifndef G_MANGER_RESMANGER_HPP #define G_MANGER_RESMANGER_HPP #include <vector> #include <string> #include <boost/utility.hpp> using namespace std; using namespace boost; namespace g { namespace manger { template<typename OBJ, typename INDEX> class base_manger : public noncopyable { public: base_manger(){} virtual ~base_manger(){} public: bool add(const OBJ &o) { OBJ *obj = new OBJ(); if(obj==NULL) return false; else *obj = o; obj_list.push_back(o); delete obj; return true; } bool remove(int index){obj_list.erase(index+1);} virtual bool remove(const INDEX&) = 0; void clear(){obj_list.clear();} bool empty(){return obj_list.empty();} int size(){return obj_list.size();} virtual void sort(const INDEX&) = 0; protected: vector<OBJ*> obj_list; }; } } #endif

你可能感兴趣的:(list,null,delete,Class)