<div class="t-tr-text">运营商<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">operator</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> delete<div class="t-tr-text">,操作员<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">, operator</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> delete[]

来自cppreference.com
< cpp | memory | new

 
 
实用工具库
类型的支持 (basic types, RTTI, type traits)
动态内存管理
错误处理
程序实用工具
可变参数函数
日期和时间
函数对象
initializer_list(C++11)
bitset
hash(C++11)
关系运算符
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
双和元组
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
掉期,远期和移动
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
动态内存管理
低级别的内存管理
分配器
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
allocator
allocator_traits(C++11)
allocator_arg_t(C++11)
allocator_arg(C++11)
uses_allocator(C++11)
scoped_allocator_adaptor(C++11)
未初始化的存储空间
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
uninitialized_copy
uninitialized_copy_n(C++11)
uninitialized_fill
uninitialized_fill_n
raw_storage_iterator
get_temporary_buffer
return_temporary_buffer
智能指针
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unique_ptr(C++11)
shared_ptr(C++11)
weak_ptr(C++11)
auto_ptr(过时了)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
垃圾收集的支持
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declare_reachable(C++11)
undeclare_reachable(C++11)
declare_no_pointers(C++11)
undeclare_no_pointers(C++11)
pointer_safety(C++11)
get_pointer_safety(C++11)
杂项
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pointer_traits(C++11)
addressof(C++11)
align(C++11)
C库
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
低级别的内存管理
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator new
operator new[]
operator delete
operator delete[]
get_new_handler(C++11)
set_new_handler
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bad_alloc
bad_array_new_length(C++11)
nothrow_t
类型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
new_handler
对象
Original:
Objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
nothrow
 
Defined in header <new>
void operator delete  ( void* ptr );
(1)
void operator delete[]( void* ptr );
(2)
void operator delete  ( void* ptr, const std::nothrow_t& );
(3)
void operator delete[]( void* ptr, const std::nothrow_t& );
(4)
void operator delete  ( void* ptr, void*);
(5)
void operator delete[]( void* ptr, void* );
(6)
将释放存储空间。 删除表达式破坏的动态对象,释放内存后,这些分配的功能被称为.
Original:
Deallocates storage. These allocation functions are called by 删除表达式 to deallocate memory after destructing dynamic objects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
将释放存储,通过调用operator new(size_t)operator new(size_t, std::nothrow_t)
Original:
Deallocates storage, obtained by a call to operator new(size_t) or operator new(size_t, std::nothrow_t)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
将释放存储,通过调用operator new[](size_t)operator new[](size_t, std::nothrow_t)
Original:
Deallocates storage, obtained by a call to operator new[](size_t) or operator new[](size_t, std::nothrow_t)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
同1-2),除非更换。这些版本被称为非投掷的新的表达式,如果调用构造函数抛出一个异常.
Original:
Same as 1-2) unless replaced. These versions are called by non-throwing new-expressions if a constructor they call throws an exception.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-6)
什么都不做。这些版本被称为放置新的表现形式,如果调用构造函数抛出一个异常.
Original:
Do nothing. These versions are called by placement new expressions if a constructor they call throws an exception.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
在所有情况下,如果ptr是一个空指针,释放函数一无所有
Original:
In all cases, if ptr is a null pointer, the deallocation function does nothing.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目录

[编辑] 更换和超载

<new>头即使不包括在每个翻译单元的版本1-4)隐式声明。这些功能是“可替换”用户提供的非成员函数具有相同签名取代了隐式的版本。至多有一个更换,也可以设置为每个四个隐式释放函数。此外,程序可以定义这些函数或类成员的版本定义配置功能不同的签名(除5-6),不可更换).
Original:
The versions 1-4) are implicitly declared in each translation unit even if the <new> header is not included. These functions are replaceable: a user-provided non-member function with the same signature replaces the implicit version. At most one replacement may be provided for each of the four implicit deallocation functions. Also, program can define class member versions of these functions or define allocation functions with different signatures (except 5-6) are not replaceable).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
的释放函数可以被替换/重载的方法有两种:
Original:
The deallocation function can be replaced/overloaded in two ways:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
“”在全球范围内:为了调用它,重载的分配函数的签名必须是可见的地方释放,除了隐式声明默认的释放函数。这种分配功能将被用于所有相应的参数在当前程序中的释放操作
Original:
in the global scope: in order to call it, the signature of the overloaded allocation functions must be visible at the place of deallocation, except for implicitly declared default deallocation functions. This allocation function will be used for all deallocations with corresponding parameters in the current program
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
在局部范围内重载operator delete必须是静态的公有成员函数的类。释放函数将只用于特定类的释放操作的.
Original:
in the local scope: the overloaded operator delete must be static public member function of the class. This deallocation function will be used only for deallocations of that particular class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
在编译过程中,每个delete表达中查找相应的释放函数的名称首先在类范围后,在全球范围内。它可以指示跳过第一步。请注意,每超载的规则,任何声明的释放函数在类的范围内隐藏了所有全球性的释放函数。欲了解更多信息,请参阅删除的表情.
Original:
During compilation, each delete expression looks up for appropriate deallocation function's name firstly in the class scope and after that in the global scope. It can be instructed to skip the first step. Note, that as per 超载的规则, any deallocation functions declared in class scope hides all global deallocation functions. For more information see 删除的表情.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 参数

ptr -
指针指向的内存区域释放或一个空指针
Original:
pointer to a memory area to deallocate or a null pointer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 返回值

(无)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 例外

noexcept specification:  
noexcept
  (C++11 起)

[编辑] 另请参阅

[编辑] 另请参阅

分配的功能
Original:
allocation functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数) [edit]
发布未初始化的存储
Original:
releases uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数)
释放内存
Original:
deallocates memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数)