std::shared_ptr::operator=
Da cppreference.com
< cpp | memory | shared ptr
![]() | 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. |
shared_ptr& operator=(const shared_ptr& r ); | (1) | |
template<class Y > shared_ptr& operator=(const shared_ptr<Y>& r ); | (1) | |
shared_ptr& operator=( shared_ptr&& r ); | (2) | |
template<class Y > shared_ptr& operator=( shared_ptr<Y>&& r ); | (2) | |
template<class Y > shared_ptr& operator=(std::auto_ptr<Y>&& r ); | (3) | |
template<class Y, class Deleter > shared_ptr& operator=(std::unique_ptr<Y,Deleter>&& r ); | (4) | |
Substitui o objeto gerenciado com a gerido por uma
1) r
.Original:
Replaces the managed object with the one managed by
r
.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.
Ações propriedade do objeto gerenciado pelo
2) r
. Se r
gere nenhum objeto, *this
gere nenhum objeto também. A sobrecarga templated não participar na resolução de sobrecarga se Y*
não é implicitamente conversível para T*
. Equivalente a shared_ptr<T> p(r).swap(*this).Original:
Shares ownership of the object managed by
r
. If r
manages no object, *this
manages no object too. The templated overload doesn't participate in the overload resolution if Y*
is not implicitly convertible to T*
. Equivalent to shared_ptr<T> p(r).swap(*this).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.
Move-atribui um
3) shared_ptr
de r
. Após a atribuição, *this contém uma cópia do estado anterior do r
, r
está vazio. A sobrecarga templated não participar na resolução de sobrecarga se Y*
não é implicitamente conversível para T*
. Equivalente a shared_ptr<T> p(std::move(r)).swap(*this).Original:
Move-assigns a
shared_ptr
from r
. After the assignment, *this contains a copy of the previous state of r
, r
is empty. The templated overload doesn't participate in the overload resolution if Y*
is not implicitly convertible to T*
. Equivalent to shared_ptr<T> p(std::move(r)).swap(*this).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.
Esta seção está incompleta |
Transfere a propriedade do objeto gerenciado pelo
r
para *this. O deleter associado a r
é armazenado para exclusão futuro do objeto gerenciado. r
gere nenhum objeto após a chamada. Equivalente a shared_ptr<T> p(std::move(r)).swap(*this).Original:
Transfers the ownership of the object managed by
r
to *this. The deleter associated to r
is stored for future deletion of the managed object. r
manages no object after the call. Equivalent to shared_ptr<T> p(std::move(r)).swap(*this).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.
Índice |
[editar]Parâmetros
r | - | outro ponteiro inteligente de compartilhar a posse ou aquisição da propriedade de Original: another smart pointer to share the ownership to or acquire the ownership from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar]Valor de retorno
*this
[editar]Notas
A implementação pode atender as necessidades sem criar um objeto
shared_ptr
temporário.Original:
The implementation may meet the requirements without creating a temporary
shared_ptr
object.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]Exceções
1-2) 3)(Nenhum)
4-5) Original:
(none)
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]Exemplo
Esta seção está incompleta Motivo: sem exemplo |
[editar]Veja também
substitui o objeto gerenciado Original: replaces 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. (função pública membro) |