From WikiChip
<new> Header - C++
The header <new> defines several functions that can be used to manage dynamic storage in C++ as part of the C++ Standard Library. This header provides a relatively low-level memory facilities. In addition to declaring a set of functions within the std namespace, several other functions are defined within the global namespace.
Contents
Functions[edit]
Function | Description | Since |
---|---|---|
operator new | allocation functions | C++98 |
operator new[] | C++98 | |
operator delete | deallocation functions | C++98 |
operator delete[] | C++98 | |
get_new_handler | retrieves the current new handler | C++11 |
set_new_handler | registers a new handler | C++11 |
Classes[edit]
Class | Description | Since |
---|---|---|
bad_alloc | thrown during a failure of memory allocation | C++98 |
bad_array_new_length | thrown on invalid length allocation | C++11 |
nothrow_t | nothrow type | C++98 |
Objects[edit]
Type | Description | Since |
---|---|---|
nothrow | nothrow constant | C++98 |
Types[edit]
Type | Description | Since |
---|---|---|
new_handler | type of a new handler function | C++98 |
Synopsis[edit]
namespace std {
class bad_alloc;
class bad_array_new_length;
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler get_new_handler() noexcept;
new_handler set_new_handler(new_handler new_p) noexcept;
}
void* operator new(std::size_t size);
void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
void operator delete(void* ptr) noexcept;
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
void* operator new[](std::size_t size);
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
void operator delete[](void* ptr) noexcept;
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
void* operator new (std::size_t size, void* ptr) noexcept;
void* operator new[](std::size_t size, void* ptr) noexcept;
void operator delete (void* ptr, void*) noexcept;
void operator delete[](void* ptr, void*) noexcept;