From 9facfd70b5a8ca4dca16fc93f6fcfe1c2bf6ce0f Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 20 Oct 2009 00:55:22 +0000 Subject: Use custom allocater to decide if refcountbase was allocated on the heap and should be deleted when refcount reaches zero git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11928 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/base.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/base.h b/include/base.h index 0de37e781..daff74e56 100644 --- a/include/base.h +++ b/include/base.h @@ -82,6 +82,8 @@ class CoreExport refcountbase virtual ~refcountbase(); inline unsigned int GetReferenceCount() const { return refcount; } friend class reference_base; + void* operator new(size_t); + void operator delete(void*); private: // uncopyable refcountbase(const refcountbase&); @@ -93,6 +95,7 @@ class CoreExport reference_base protected: template static inline unsigned int inc(T* v) { return ++(v->refcount); } template static inline unsigned int dec(T* v) { return --(v->refcount); } + }; template @@ -189,6 +192,8 @@ class CoreExport ModuleException : public CoreException ModuleException(const std::string &message, Module* me = NULL); }; +/** Module reference, similar to reference + */ class CoreExport ModuleRef : public reference_base { Module* const value; -- cgit v1.2.3