23#ifndef __ODAALLOCOP_H__
24#define __ODAALLOCOP_H__
31#if !defined(_WIN32_WCE)
34#pragma warning(disable: 4290)
37#if (defined(__GNUC__) && __GNUC__ >= 5 && __cpp_sized_deallocation >= 201309) || (defined(_MSC_VER) && _MSC_VER >= 1800)
38#define ODRX_SIZED_DEALLOC_OPERATORS() \
39 void operator delete(void* p, std::size_t) \
44 void operator delete[](void* p, std::size_t) \
49 void operator delete(void* ptr, std::size_t s, const std::nothrow_t&) \
51 operator delete(ptr, s); \
53 void operator delete[](void* ptr, std::size_t s, const std::nothrow_t&) \
55 operator delete[](ptr, s); \
59 #define ODRX_SIZED_DEALLOC_OPERATORS()
62#define ODRX_NOTHROW_ALLOC_OPERATORS() \
63void *operator new (size_t size, const std::nothrow_t&) throw() { return operator new(size); } \
64void * operator new[] (::size_t count, const std::nothrow_t&) throw() { return operator new[](count); }\
65void operator delete[](void *ptr, const std::nothrow_t&) throw() { operator delete[](ptr); } \
66void operator delete (void *ptr, const std::nothrow_t&) throw() { operator delete(ptr); } \
69 #define ODRX_ALLOC_OPERATORS() \
70 void* operator new (size_t size) \
72 void* p = ::odrxAlloc(size); \
73 if (!p && size) NEW_HANDLER() \
76 void operator delete (void *p) throw() \
81 void* operator new[](size_t size) \
83 void* p = ::odrxAlloc(size); \
84 if (!p && size) NEW_HANDLER() \
87 void operator delete[](void *p) throw() \
92 ODRX_NOTHROW_ALLOC_OPERATORS() \
93 ODRX_SIZED_DEALLOC_OPERATORS() \
96 #define ODRX_ALLOC_OPERATORS() \
97 void* operator new (size_t size) \
99 void* p = ::odrxAlloc(size); \
101 if (!p && size) NEW_HANDLER() \
104 void operator delete (void *p) throw() \
109 void* operator new[](size_t size) \
111 void* p = ::odrxAlloc(size); \
112 if (!p && size) NEW_HANDLER() \
115 void operator delete[](void *p) throw() \
120 ODRX_NOTHROW_ALLOC_OPERATORS() \
121 ODRX_SIZED_DEALLOC_OPERATORS() \
126#define ODRX_ALLOC_OPERATORS()
127#define ODRX_CRTDBG_MAP_ALLOC_OPERATORS()
133#if (_MSC_VER >= 1200) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
135#define ODRX_CRTDBG_MAP_ALLOC_OPERATORS() \
136extern "C" { extern _CRTIMP void * __cdecl _malloc_dbg(size_t, int, const char *, int); } \
137void* __cdecl operator new(size_t size, int type, const char* fname, int line) { return _malloc_dbg(size, type, fname, line); } \
138void* __cdecl operator new[](size_t size, int type, const char* fname, int line) { return operator new(size, type, fname, line); } \
143#define TD_CDECL __cdecl
148#if !defined(_WIN32_WCE)
149#define ODRX_CRTDBG_MAP_ALLOC_OPERATORS() \
150void* TD_CDECL operator new(size_t size, int, const char*,int) { return ::operator new(size); } \
151void* TD_CDECL operator new[](size_t size, int, const char*, int) { return ::operator new[](size); }