std::basic_filebuf::operator=
De cppreference.com
|
|
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_filebuf& operator=( std::basic_filebuf&& rhs ); |
(desde C++11) | |
std::basic_filebuf& operator=( const std::basic_filebuf& rhs ) = delete; |
||
1)
En primer lugar llama
close() para cerrar el archivo asociado, entonces se mueve el contenido de rhs en *this: el put y get buffers, el archivo asociado, la configuración regional, el openmode, la bandera is_open, y cualquier otro estado. Después del movimiento, rhs no está asociado con un archivo y rhs.is_open() == false .Original:
First calls
close() to close the associated file, then moves the contents of rhs into *this: the put and get buffers, the associated file, the locale, the openmode, the is_open flag, and any other state. After the move, rhs is not associated with a file and rhs.is_open() == false.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_filebuf no es CopyAssignable .Original:
The copy assignment operator is deleted;
basic_filebuf 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 | - | otro
basic_filebuf que se moverá desdeOriginal: another basic_filebuf 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
Ejemplo
Ejecuta este código
#include <fstream>
#include <string>
#include <iostream>
int main()
{
std::ifstream fin("test.in"); // read-only
std::ofstream fout("test.out"); // write-only
std::string s;
getline(fin, s);
std::cout << s << '\n'; // output
*fin.rdbuf() = std::move(*fout.rdbuf());
getline(fin, s);
std::cout << s << '\n'; // empty line
std::cout << std::boolalpha << fout.is_open() << '\n'; // prints "false"
}
Ver también
construye un objeto basic_filebuf Original: constructs a basic_filebuf object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro pública) | |
(C++11) |
swaps dos objetos basic_filebuf Original: swaps two basic_filebuf objects The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro pública) |