xref: /reactos/sdk/include/c++/new (revision 1734f297)
1// Standard C++ dynamic memory management header
2
3#ifndef _NEW
4#define _NEW
5
6#include <cstddef>
7#include <exception>
8
9extern "C++" {
10
11class bad_alloc : public exception
12{
13public:
14    bad_alloc(const char *name = "bad alloc") throw()
15        : exception(name) { }
16
17    virtual ~bad_alloc() throw() { }
18};
19
20namespace std
21{
22    using ::bad_alloc;
23
24    struct nothrow_t { };
25
26    extern const nothrow_t nothrow;
27} // namespace std
28
29typedef void (*new_handler)();
30
31new_handler set_new_handler(new_handler) throw();
32
33void* operator new (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
34inline void* operator new (std::size_t size, void* ptr) throw() { return ptr; }
35void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
36inline void* operator new[] (std::size_t size, void* ptr) throw() { return ptr; }
37
38void operator delete (void* ptr) throw ();
39void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw();
40inline void operator delete (void* ptr, void* voidptr2) throw() { }
41void operator delete[] (void* ptr) throw ();
42void operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw();
43inline void operator delete[] (void* ptr, void* voidptr2) throw() { }
44
45} // extern "C++"
46
47#endif
48