delete expression - cppreference.com
De cppreference.com
<metanoindex/>
Sintaxe
::(opcional) delete expression
|
(1) | ||||||||
::(opcional) delete [] expression
|
(2) | ||||||||
Explicação
Objetos destrói, previamente construído pela expressão new e libera a área de memória obtido. O expression deve resultar em um valor de ponteiro que foi devolvido pela chamada anterior à expressão new. Para únicos objetos alocados a primeira versão da expressão deve ser utilizada, enquanto que para matrizes a segunda versão deve ser usada. Não há expressão de exclusão desalocando objetos inicializados pela colocação' novo, função desalocação e destruidor deve ser explicitamente chamado.
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.
A memória é desalocado por um função desalocação, quer operator delete (para a primeira versão da expressão) ou operator delete[] (para a segunda versão da expressão).
Original:
The memory is deallocated by an função desalocação, 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.
O nome da função desalocação é em primeiro lugar procurado no local, classe' tipo de escopo e somente se a pesquisa falhar, o espaço global é procurado. Se :: está presente na expressão delete, somente o namespace global está olhou para cima. O protótipo da função deve ter a seguinte aparência:
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.
<tbody> </tbody>
|
|
for the first version | |
|
|
for the second version | |
Ambas as funções são declarados implicitamente em cada unidade de tradução. Além disso, as implementações implícitas são fornecidos pelo compilador por padrão, a menos que o programa foi implementado explicitamente eles. Veja este para mais informações.
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 este 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.