Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / cp / inc / new
1 // The -*- C++ -*- dynamic memory management header.
2 // Copyright (C) 1994, 96-97, 1998 Free Software Foundation
3
4 #ifndef __NEW__
5 #define __NEW__
6
7 #pragma interface "new"
8 #include <stddef.h>
9 #include <exception>
10
11 extern "C++" {
12
13 namespace std {
14
15   class bad_alloc : public exception {
16   public:
17     virtual const char* what() const throw() { return "bad_alloc"; }
18   };
19
20   struct nothrow_t {};
21   extern const nothrow_t nothrow;
22   typedef void (*new_handler)();
23   new_handler set_new_handler (new_handler);
24
25 } // namespace std
26
27 // replaceable signatures
28 void *operator new (size_t) throw (std::bad_alloc);
29 void *operator new[] (size_t) throw (std::bad_alloc);
30 void operator delete (void *) throw();
31 void operator delete[] (void *) throw();
32 void *operator new (size_t, const std::nothrow_t&) throw();
33 void *operator new[] (size_t, const std::nothrow_t&) throw();
34 void operator delete (void *, const std::nothrow_t&) throw();
35 void operator delete[] (void *, const std::nothrow_t&) throw();
36
37 // default placement versions of operator new
38 inline void *operator new(size_t, void *place) throw() { return place; }
39 inline void *operator new[](size_t, void *place) throw() { return place; }
40 } // extern "C++"
41
42 #endif