summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel De Graaf <danieldg@inspircd.org>2010-08-17 19:36:35 -0400
committerDaniel De Graaf <danieldg@inspircd.org>2010-08-17 19:37:19 -0400
commit8a0f4e8c369bfc08ce4d055a3ef4f5cbf2cd3c93 (patch)
tree5780dc103e8c6b913936013b97942a2edfcb01ef /include
parent4bb6a09697b5f55a66bba431bc2ac98b1535973d (diff)
Include a placement operator new for classes that hide operator new
Diffstat (limited to 'include')
-rw-r--r--include/base.h15
1 files changed, 9 insertions, 6 deletions
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<T>& other) const { return value < other.value; }
inline bool operator>(const reference<T>& 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.