std::basic_stringbuf::operator=
De cppreference.com
<metanoindex/>
<tbody> </tbody> std::basic_stringbuf& operator=( std::basic_stringbuf&& rhs ); |
(desde C++11) | |
std::basic_stringbuf& operator=( const std::basic_stringbuf& rhs ) = delete; |
||
1)
Mova operador de atribuição: Move o conteúdo de
rhs em *this. Após a mudança, lhs tem a seqüência associada, o modo de abertura, o local, e todos os outro estado anteriormente ocupado por rhs. Os seis ponteiros do std::basic_streambuf em lhs são garantidos para ser diferente dos ponteiros correspondentes na rhs moveu-de não ser 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)
O operador de atribuição de cópia é apagado;
basic_stringbuf não é 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.
Parâmetros
| rhs | - | outro
basic_stringbuf que será movido a partir deOriginal: 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. |
Valor de retorno
*this
Exemplo
#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";
}
Saída:
Before move, one = "one" two = "two"
Before move, one = "two" two = ""
