std::basic_stringbuf::operator=
De cppreference.com
< cpp | io | basic stringbuf
![]() | Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate. La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
std::basic_stringbuf& operator=(std::basic_stringbuf&& rhs ); | (desde C++11) | |
std::basic_stringbuf& operator=(conststd::basic_stringbuf& rhs )= delete; | ||
1)
Mueva operador de asignación: Mueve el contenido de
rhs
en *this
. Después de la mudanza, lhs
tiene la cadena asociada, la modalidad abierta, el lugar, y todo otro estado antes en manos de rhs
. Los seis punteros de std::basic_streambuf en lhs
están garantizados para ser diferentes de los punteros correspondientes en el rhs
-movido desde menos nulo .Original:
Move assignment operator: Moves the contents of
rhs
into *this
. After the move, lhs
has the associated string, the open mode, the locale, and all other state formerly held by rhs
. The six pointers of std::basic_streambuf in lhs
are guaranteed to be different from the corresponding pointers in the moved-from rhs
unless null.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)
El operador de asignación de copia se suprime
basic_stringbuf
no es CopyAssignable
.Original:
The copy assignment operator is deleted;
basic_stringbuf
is not CopyAssignable
.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.
Contenido |
[editar]Parámetros
rhs | - | otro basic_stringbuf que se moverá desdeOriginal: another basic_stringbuf that will be moved fromThe 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]Ejemplo
Ejecuta este código
#include <sstream>#include <string>#include <iostream> int main(){ std::istringstream one("one");std::ostringstream two("two"); std::cout<<"Before move, one = \""<< one.str()<<'"'<<" two = \""<< two.str()<<"\"\n"; *one.rdbuf()= std::move(*two.rdbuf()); std::cout<<"Before move, one = \""<< one.str()<<'"'<<" two = \""<< two.str()<<"\"\n";}
Salida:
Before move, one = "one" two = "two" Before move, one = "two" two = ""
[editar]Ver también
Construye un objeto basic_stringbuf . (función miembro pública) |