std::basic_stringstream::basic_stringstream
提供: cppreference.com
< cpp | io | basic stringstream
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
basic_stringstream( ios_base::openmode mode = ios_base::in|ios_base::out ); |
(1) | |
basic_stringstream( const std::basic_string<CharT,Traits,Allocator>& str, ios_base::openmode mode = ios_base::in|ios_base::out ); |
(2) | |
basic_stringstream( basic_stringstream&& other ); |
(3) | (C++11およびそれ以降) |
新しい文字列ストリームを構築し.
1) Original:
Constructs new string stream.
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) basic_stringbuf
オブジェクトはbasic_stringbuf<Char,Traits,Allocator>(mode).として構成されているOriginal:
Constructs new underlying string device. The underlying
basic_stringbuf
object is constructed as basic_stringbuf<Char,Traits,Allocator>(mode).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.
基になる文字列デバイスの初期コンテンツとして
3) str
のコピーを使用します。基礎basic_stringbuf
オブジェクトはbasic_stringbuf<Char,Traits,Allocator>(str, mode).として構成されているOriginal:
Uses a copy of
str
as initial contents of the underlying string device. The underlying basic_stringbuf
object is constructed as basic_stringbuf<Char,Traits,Allocator>(str, mode).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.
コンストラクタを移動します。ムーブセマンティクスを使用して
other
の状態とファイルストリームを構築します. Original:
Move constructor. Constructs the file stream with the state of
other
using move semantics. 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.
[編集] パラメータ
str | - | 文字列ストリームの最初のコンテンツとして使用する文字列
Original: string to use as initial contents of the string stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | - | ストリームのオープンモードを指定します。それはビットマスク型ですが、以下の定数が定義されています:
Original: specifies stream open mode. It is bitmask type, the following constants are defined:
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
other | - | ソースとして使用する別の文字列ストリーム
Original: another string stream to use as source The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 例
このコードを実行します
#include <iostream> #include <sstream> int main() { // default constructor (input/output stream) std::stringstream buf1; buf1 << 7; int n = 0; buf1 >> n; std::cout << "buf1 = " << buf1.str() << " n = " << n << '\n'; // input stream std::istringstream inbuf("-10"); inbuf >> n; std::cout << "n = " << n << '\n'; // output stream in append mode (C++11) std::ostringstream buf2("test", std::ios_base::ate); buf2 << '1'; std::cout << buf2.str() << '\n'; }
出力:
buf1 = 7 n = 7 n = -10 test1
[編集] も参照してください
基になる文字列デバイスオブジェクトの内容を取得または設定します Original: gets or sets the contents of underlying string device object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
basic_stringbufオブジェクトを作成します Original: constructs a basic_stringbuf object 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_stringbuf )
|