<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
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| 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) | |
将释放存储空间。 删除表达式破坏的动态对象,释放内存后,这些分配的功能被称为.
1) 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.
You can help to correct and verify the translation. Click here for instructions.
将释放存储,通过调用operator new(size_t)或operator new(size_t, std::nothrow_t)
2) 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.
You can help to correct and verify the translation. Click here for instructions.
将释放存储,通过调用operator new[](size_t)或operator new[](size_t, std::nothrow_t)
3-4) 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.
You can help to correct and verify the translation. Click here for instructions.
同1-2),除非更换。这些版本被称为非投掷的新的表达式,如果调用构造函数抛出一个异常.
5-6) 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.
You can help to correct and verify the translation. Click here for instructions.
什么都不做。这些版本被称为放置新的表现形式,如果调用构造函数抛出一个异常.
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.
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.
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.
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.
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 programThe 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 overloadedoperator deletemust 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.
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.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 例外
[编辑] 另请参阅
[编辑] 另请参阅
| 分配的功能 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. (函数) | |
| 发布未初始化的存储 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. (函数) | |