std::auto_ptr
De cppreference.com
<metanoindex/>
<tbody> </tbody>| Definido no cabeçalho <memory>
|
||
template< class T > class auto_ptr; |
(1) | (obsoleta) |
template<> class auto_ptr<void> |
(2) | (obsoleta) |
auto_ptr é um ponteiro inteligente que gerencia um objeto obtido através de novo e elimina o objeto quando auto_ptr si é destruído. Ele pode ser usado para garantir a segurança de exceção para objetos dinamicamente alocados, para passar a propriedade de objetos dinamicamente alocados em funções e retornando objetos dinamicamente alocados de funções.Original:
auto_ptr is a smart pointer that manages an object obtained via new and deletes that object when auto_ptr itself is destroyed. It may be used to provide exception safety for dynamically-allocated objects, for passing ownership of dynamically-allocated objects into functions and for returning dynamically-allocated objects from functions.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.
Copiando um
auto_ptr copia o ponteiro e transfere a propriedade para o destino: tanto a construção de cópia e de atribuição de cópia de auto_ptr modificar seus argumentos mão direita, e da "cópia" não é igual ao original. Devido a estas semântica de cópia não usuais, auto_ptr não podem ser colocados em contentores normalizados. std::unique_ptr é o preferido para este e para outros fins.Original:
Copying an
auto_ptr copies the pointer and transfers ownership to the destination: both copy construction and copy assignment of auto_ptr modify their right hand arguments, and the "copy" is not equal to the original. Because of these unusual copy semantics, auto_ptr may not be placed in standard containers. std::unique_ptr is preferred for this and other uses.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.
2)
Especialização para
void tipo é fornecido, ele declara a element_type typedef, mas não as funções de membro.Original:
Specialization for type
void is provided, it declares the typedef element_type, but no member functions.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.
Tipos de membro
Tipo de membro
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
element_type
|
T
|
