std::basic_filebuf::operator=
Aus cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody> std::basic_filebuf& operator=( std::basic_filebuf&& rhs ); |
(seit C++11) | |
std::basic_filebuf& operator=( const std::basic_filebuf& rhs ) = delete; |
||
1)
Ruft zuerst
close() die zugehörige Datei zu schließen, dann bewegt sich die Inhalte der rhs in *this: die put und get-Puffer, die zugehörige Datei, die locale, die openmode die is_open Flagge, und jeder andere Staat. Nach dem Umzug wird rhs nicht mit einer Datei und rhs.is_open() == false assoziiert .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)
Der Zuweisungsoperator wird gestrichen;
basic_filebuf nicht 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.
Parameter
| rhs | - | anderen
basic_filebuf Das wird von verschoben werdenOriginal: 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. |
Rückgabewert
*this
Beispiel
#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"
}
Siehe auch
konstruiert eine basic_filebuf Objekt 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. (öffentliche Elementfunktion) | |
(C++11) |
Swaps zwei basic_filebuf Objekte 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. (öffentliche Elementfunktion) |