名前空間
変種
操作

std::basic_istream::basic_istream

提供: cppreference.com
< cpp‎ | io‎ | basic istream

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
ファイルI / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
文字列I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
アレイのI / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
エラーカテゴリインターフェース
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_istream
グローバルオブジェクト
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cin
wcin
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::basic_istream
basic_istream::~basic_istream
basic_istream::operator=(C++11)
書式付き入力
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::operator>>
書式なし入力
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::get
basic_istream::peek
basic_istream::unget
basic_istream::putback
basic_istream::getline
basic_istream::ignore
basic_istream::read
basic_istream::readsome
basic_istream::gcount
ポジショニング
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::tellg
basic_istream::seekg
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sync
basic_istream::swap(C++11)
メンバークラス
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sentry
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator>>(std::basic_istream)
 
explicit basic_istream( std::basic_streambuf<CharT,Traits>* sb);
(1)
protected:
basic_istream( const basic_istream& rhs ) = delete;
(2)
protected:
basic_istream( basic_istream&& rhs );
(3) (C + + 11以来)
1)
basic_istreamを呼び出すことによって、基底クラスに初期値を代入し、basic_ios::init(sb)オブジェクトを構築します。 gcount()の値がゼロに初期化され.
Original:
Constructs the basic_istream object, assigning initial values to the base class by calling basic_ios::init(sb). The value of gcount() is initialized to zero.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
コピーコンストラクタは保護されており、削除されます。入力ストリームがコピーできませんです.
Original:
The copy constructor is protected, and is deleted. Input streams are not copyable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
ムーブコンストラクタはgcount()からrhsの値をコピーし、ゼロにrhsのgcount()の値を設定し、basic_ios<charT, traits>::move(rhs)rdbuf()から、rhsを除き、すべてのbasic_iosメンバーを移動する*thisを使用しています。このムーブコンストラクタは保護されています:それは、可動入力ストリームクラスのムーブコンストラクタstd::basic_ifstreamstd::basic_istringstream、正しく関連付けられたストリームバッファを移動する方法を知っているから呼び出されます.
Original:
The move constructor copies the value of gcount() from rhs, sets the gcount() value of rhs to zero, and uses basic_ios<charT, traits>::move(rhs) to move all basic_ios members, except for the rdbuf(), from rhs into *this. This move constructor is protected: it is called by the move constructors of movable input stream classes std::basic_ifstream and std::basic_istringstream, which know how to correctly move the associated streambuffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] パラメータ

sb -
基本となるデバイスとして使用するストリームバッファ
Original:
streambuffer to use as underlying device
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <sstream>
#include <iostream>
int main()
{
    std::istringstream s1("hello");
    std::istream s2(s1.rdbuf());                        // OK: s2 shares the buffer with s1
 
//    std::istream s3(std::istringstream("test"));      // ERROR: move constructor is protected
//    std::istream s4(s2);                              // ERROR: copy constructor is deleted
    std::istringstream s5(std::istringstream("world")); // OK: move ctor called by derived class
 
    std::cout << s2.rdbuf() << ' ' << s5.rdbuf() << '\n';
}

Output:

hello world