std::bad_weak_ptr - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
| Elemento definito nell'header <memory> |
||
|
|
(dal C++11) | |
std::bad_weak_ptr è il tipo di oggetto lanciato come eccezioni dai costruttori di std::shared_ptr che prendono std::weak_ptr come argomento, quando il std::weak_ptr si riferisce ad un oggetto già eliminati.
Original:
std::bad_weak_ptr is the type of the object thrown as exceptions by the constructors of std::shared_ptr that take std::weak_ptr as the argument, when the std::weak_ptr refers to an already deleted object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inheritance diagram
Membri funzioni
costruisce l'oggetto Original: constructs the The text has been machine-translated via Google Translate. (metodo pubblico) | |
Inherited from std::exception
Member functions
distrugge l'oggetto eccezione Original: destructs the exception object The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
restituisce una stringa esplicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
Esempio
#include <memory> #include <iostream> int main() { std::shared_ptr<int> p1(new int(42)); std::weak_ptr<int> wp(p1); p1.reset(); try { std::shared_ptr<int> p2(wp); } catch(const std::bad_weak_ptr& e) { std::cout << e.what() << '\n'; } }
Output:
Vedi anche
| smart pointer with shared object ownership semantics (classe template) [modifica] | |
riferimento debole a un oggetto gestito da std::shared_ptr Original: weak reference to an object managed by std::shared_ptr The text has been machine-translated via Google Translate. (classe template) [modifica] | |