Espaços nominais
Variantes
Acções

std::bad_weak_ptr

Da cppreference.com
< cpp‎ | memory

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
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)
 
Gerenciamento de memória dinâmica
Gerenciamento de memória de baixo nível
Alocadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uninitialized armazenamento
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ponteiros inteligentes
Original:
Smart pointers
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)
(obsoleta)
(C++11)
bad_weak_ptr
(C++11)
Apoio a coleta de lixo
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Diversos
Original:
Miscellaneous
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 Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::bad_weak_ptr
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bad_weak_ptr::bad_weak_ptr
 
Definido no cabeçalho <memory>
class bad_weak_ptr;
(desde C++11)
std::bad_weak_ptr é o tipo do objeto lançado como exceções pelos construtores de std::shared_ptr que levam std::weak_ptr como argumento, quando o std::weak_ptr refere-se a um objeto j�� eliminado.
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.
cpp/error/exceptionstd-bad weak ptr-inheritance.svg
Sobre esta imagem

Inheritance diagram

Índice

[editar] Funções de membro

constrói o objeto bad_weak_ptr
Original:
constructs the bad_weak_ptr object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)

Herdado de std::exception

Member functions

[virtual]
destrói o objeto de exceção
Original:
destructs the exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::exception função pública virtual membro) [edit]
[virtual]
retorna uma cadeia explicativa
Original:
returns an explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::exception função pública virtual membro) [edit]

[editar] Exemplo

#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';
    }
}

Saída:

std::bad_weak_ptr

[editar] Veja também

smart pointer with shared object ownership semantics
(modelo de classe) [edit]
(C++11)
referência fraca para um objeto gerenciado por std::shared_ptr
Original:
weak reference to an object managed by std::shared_ptr
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de classe) [edit]