From: Daniel De Graaf Date: Tue, 17 Aug 2010 23:36:35 +0000 (-0400) Subject: Include a placement operator new for classes that hide operator new X-Git-Tag: v2.0.23~849 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8a0f4e8c369bfc08ce4d055a3ef4f5cbf2cd3c93;p=user%2Fhenk%2Fcode%2Finspircd.git Include a placement operator new for classes that hide operator new --- diff --git a/include/base.h b/include/base.h index 8d8f7b96c..7926779eb 100644 --- a/include/base.h +++ b/include/base.h @@ -52,11 +52,12 @@ class CoreExport interfacebase { public: interfacebase() {} + static inline void* operator new(size_t, void* m) { return m; } private: interfacebase(const interfacebase&); void operator=(const interfacebase&); - void* operator new(size_t); - void operator delete(void*); + static void* operator new(size_t); + static void operator delete(void*); }; /** The base class for inspircd classes that support reference counting. @@ -79,8 +80,9 @@ class CoreExport refcountbase refcountbase(); virtual ~refcountbase(); inline unsigned int GetReferenceCount() const { return refcount; } - void* operator new(size_t); - void operator delete(void*); + static inline void* operator new(size_t, void* m) { return m; } + static void* operator new(size_t); + static void operator delete(void*); inline void refcount_inc() const { refcount++; } inline bool refcount_dec() const { refcount--; return !refcount; } private: @@ -137,9 +139,10 @@ class reference inline T& operator*() const { return *value; } inline bool operator<(const reference& other) const { return value < other.value; } inline bool operator>(const reference& other) const { return value > other.value; } + static inline void* operator new(size_t, void* m) { return m; } private: - void* operator new(size_t); - void operator delete(void*); + static void* operator new(size_t); + static void operator delete(void*); }; /** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.