Cpp Standard Library 简明教程

C++ Library - <new>

Introduction

它是一个用于描述在 C++ 中管理动态存储的函数的头文件。此头文件还定义了一些特定的类型和 set_new_handler / get_new_handler 函数对,如下所示 −

It is a header describes functions used to manage dynamic storage in C++.The header also defines some specific types and the set_new_handler / get_new_handler pair of functions as shown below −

Functions

Sr.No.

Function & description

1

operator newIt allocates storage space.

2

operator new[]It allocates storage space for array.

3

operator deleteIt deallocates storage space.

4

operator delete[]It deallocates storage space of array.

5

get_new_handler It is used to get new handler function.

Types

Sr.No.

Type & description

1

nothrow_tIt is a nathrow type.

2

new_handlerIt is a type of new handler function.

3

bad_allocIt is an exception and throws on failure allocating memory.

4

bad_array_new_lengthIt is a bad array length exception.

Constants

Sr.No.

Constant & description

1

nothrowIt is a nathrow constants.