std::auto_ptr
De 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. |
| Definido en la cabecera <memory>
|
||
| template< class T > class auto_ptr; |
(1) | (obsoleto) |
| template<> class auto_ptr<void> |
(2) | (obsoleto) |
auto_ptr es un puntero inteligente que maneja un objeto obtenido a través de nuevas y elimina ese objeto cuando auto_ptr sí mismo se destruye. Se puede utilizar para proporcionar la seguridad de excepción para los objetos asignados de forma dinámica, para pasar la propiedad de objetos asignados de forma dinámica en funciones y para el retorno de los objetos asignados de forma dinámica a partir de funciones .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.
Copia de un
2) auto_ptr copia el puntero y la propiedad se transfiere al destino: tanto en la construcción y asignación de copia de copia de auto_ptr modificar sus argumentos de la derecha, y la "copia" no es igual a la original. Debido a estas semántica de copia inusuales, auto_ptr no pueden ser colocados en contenedores estándar. std::unique_ptr se prefiere para este y otros usos .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.
Especialización para void tipo se proporciona, declara la
element_type typedef, pero las funciones de miembro .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.
[editar] Tipos de miembros
| Miembro de tipo
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 |
[editar] Las funciones miembro
| crea una nueva auto_ptr Original: creates a new auto_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
| destruye un auto_ptr y el objeto administrado Original: destroys an auto_ptr and the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
| transfiere la propiedad de otro auto_ptr Original: transfers ownership from another auto_ptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
| convierte el puntero administrado a un puntero de tipo diferente Original: converts the managed pointer to a pointer to different type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
Original: Modifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| destruye el objeto administrado Original: destroys the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
| libera la propiedad del objeto administrado Original: releases ownership of the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
Original: Observers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| obtiene un puntero al objeto administrado Original: obtains a pointer to the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |
| acceso al objeto gestionado Original: accesses the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro público) | |

