std::basic_filebuf::swap
提供: cppreference.com
< cpp | io | basic filebuf
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
void swap( std::basic_filebuf& rhs ) |
(C++11およびそれ以降) | |
スワップ状態と*thisの内容と
rhs
.Original:
Swaps the state and the contents of *this and
rhs
.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.
目次 |
[編集] パラメータ
rhs | - | 別
basic_filebuf Original: another basic_filebuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
(なし)
[編集] ノート
std::fstreamオブジェクトをスワップする際に、この関数が自動的に呼び出され、それはそれを直接呼び出すことがほとんど必要ありません.
Original:
This function is called automatically when swapping std::fstream objects, it is rarely necessary to call it directly.
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.
[編集] 例
このコードを実行します
#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'; // outputs the first line of test.in fin.rdbuf()->swap(*fout.rdbuf()); //swap the underlying buffers getline(fin, s); // fails: cannot read from a write-only filebuf std::cout << s << '\n'; // prints empty line }
[編集] 参照
(C++11) |
basic_filebufオブジェクトを割り当てます Original: assigns 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. (パブリックメンバ関数) |
std::swapアルゴリズムを専門としています Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
(C++11) |
スワップ2ファイルストリーム Original: swaps two file streams The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数of std::basic_fstream )
|