The Wayback Machine - https://web.archive.org/web/20130629053104/http://zh.cppreference.com:80/w/cpp/language/delete

delete expression

来自cppreference.com

 
 
C + +語言
大會的主題
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
流量控制
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
條件執行語句
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
迭代語句
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
跳轉語句
Original:
Jump statements
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.
函數聲明
lambda函數的聲明
函數模板
的歷史。內嵌說明
異常規範 (過時了)
noexcept說明 (C++11)
例外
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
命名空間
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
decltype specifier (C++11)
規範
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CV符
存儲時間說明符
constexpr說明 (C++11)
汽車符 (C++11)
alignas說明 (C++11)
初始化
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
布爾文字
nullptr (C++11)
用戶定義的 (C++11)
表達式
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
另一種表示形式
實用工具
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類型
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
聲明類型別名 (C++11)
屬性 (C++11)
施放
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
隱式轉換
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
C-風格和功能轉換
內存分配
Original:
Memory allocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
delete expression
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類特定的功能特性
Original:
Class-specific function properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
虛函數
覆蓋說明 (C++11)
最後說明 (C++11)
明確的 (C++11)
靜態的
特殊的成員函數
Original:
Special member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
模板
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
類模板
函數模板
模板特化
參數包 (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.
內聯彙編
 
和釋放
Original:
Destructs object(s) previously allocated by the
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 語法

::(可選的)    delete    expression (1)
::(可選的)    delete [] expression (2)

[编辑] 解釋

銷毀對象,構建new表達和釋放所獲得的內存區域。 expression導致的new表達的以前調用所返回的指針的值。對於單一的分配對象的第一個版本必須使用的表達,而對數組的第二個版本,必須使用。有沒有刪除的的表達釋放對象初始化「位置」,釋放函數和析構函數必須顯式調用.
Original:
Destructs objects, previously constructed by new expression and releases the obtained memory area. The expression must result in a pointer value that was returned by previous call to the new expression. For single allocated objects the first version of the expression must be used, whereas for arrays the second version must be used. There is no delete expression deallocating objects initialized by placement new, deallocation function and destructor must be explicitly called.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
該存儲器被釋放釋放函數,要麼operator delete(第一版本的表達)或operator delete[](表達式的第二個版本).
Original:
The memory is deallocated by an 釋放函數, either operator delete (for the first version of the expression) or operator delete[] (for the second version of the expression).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
釋放函數的名稱首先在本地類「類型」的範圍抬起頭來,只有當查找失敗,全局命名空間抬起頭來。 ::delete表達,只有全局命名空間抬起頭來。該函數的原型必須看起來像下面這樣:
Original:
The deallocation function's name is firstly looked up in the local class type scope and only if the lookup fails, the global namespace is looked up. If :: is present in the delete expression, only the global namespace is looked up. The prototype of the function must look like the following:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
void operator delete  (void *ptr);
for the first version
void operator delete[](void *ptr);
for the second version
這兩個函數隱式聲明每個翻譯單元。此外,隱式實現由編譯器在默認情況下,除非程序顯式實現。有關更多信息,請參見這一點.
Original:
Both these functions are implicitly declared in each translation unit. Also, implicit implementations are provided by the compiler by default, unless the program has explicitly implemented them. See 這一點 for more information.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 關鍵字

delete