名前空間
変種
操作

std::basic_ostream::operator<<

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

 
 
入力/出力ライブラリ
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_ostream
グローバルオブジェクト
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.
メンバ関数
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_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::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_ostream::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_ostream::put
basic_ostream::write
ポジショニング
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_ostream::tellp
basic_ostream::seekp
その他
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_ostream::flush
basic_ostream::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_ostream::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_ostream)
 
basic_ostream& operator<<( short value );
basic_ostream& operator<<( unsigned short value );
(1)
basic_ostream& operator<<( int value );
basic_ostream& operator<<( unsigned int value );
(2)
basic_ostream& operator<<( long value );
basic_ostream& operator<<( unsigned long value );
(3)
basic_ostream& operator<<( long long value );
basic_ostream& operator<<( unsigned long long value );
(4) (C++11およびそれ以降)
basic_ostream& operator<<( float value );

basic_ostream& operator<<( double value );

basic_ostream& operator<<( long double value );
(5)
basic_ostream& operator<<( bool value );
(6)
basic_ostream& operator<<( const void* value );
(7)
basic_ostream& operator<<( std::basic_streambuf<CharT, Traits>* sb);
(8)
basic_ostream& operator<<( basic_ostream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_ostream& operator<<( basic_ostream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_ostream& operator<<( basic_ostream& st,

                           std::basic_ostream& (*func)(std::basic_ostream&) );
(9)
挿入データからデータ.
Original:
Inserts data into the stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
演算子の(1-7)のバージョンは、フォーマットされた出力機能として動作し、8)のバージョンでは、未フォーマットの出力機能を動作します。これらの関数は、型sentryのオブジェクトを作成することにより、実行を開始しているフラッシュしtie()'d出力バッファおよび必要に応じてストリームエラーをチェックします。建設後、false監視オブジェクトを返した場合、関数は、任意の出力をしようとせずに戻ります。エラーが出力時に発生した場合は、書式付き出力関数はsetstate(ios_base::failbit)を設定します。例外が出力時にスローされた場合、その後はios :: badbitをは((exceptions()&badbit) != 0が、その場合、それがスローされない限り、例外が抑制されている)が設定されます
Original:
The (1-7) versions of the operator behave as formatted output functions, and the 8) version behaves as unformatted output function. These functions begin execution by constructing an object of type sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the functions return without attempting any output. If an error occurs during output, formatted output functions set setstate(ios_base::failbit). If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless (exceptions()&badbit) != 0, in which case it is rethrown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
valueある場合shortまたはint、その後にキャストunsigned shortまたはunsigned int場合ios_base::flags() & ios_base::basefieldですios_base::octまたはios_base::hex。その後、3)のように、どのような場合でも、出力にlongにキャストします。もしvalueですunsigned shortまたはunsigned int、)3のようunsigned longおよび出力にキャストします
Original:
If value is short or int, then casts it to unsigned short or unsigned int if ios_base::flags() & ios_base::basefield is ios_base::oct or ios_base::hex. After that, casts to long in any case and outputs as in 3). If value is unsigned short or unsigned int, casts to unsigned long and outputs as in 3)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
挿入num_put::put()を呼び出すことによって整数値。ファイルの終わり状態が出力時に遭遇した場合(put().failed() == true)、ios::badbit設定.
Original:
Inserts an integer value by calling num_put::put(). If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
挿入ファイルの終わり状態を出力(num_put::put())中に発生した場合put().failed() == trueを呼び出すことにより、浮動小数点値は、ios::badbit設定.
Original:
Inserts a floating point value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
ファイルの終わり状態を出力(bool)中に発生した場合num_put::put()を呼び出すことにより、挿入put().failed() == true値は、ios::badbitを設定.
Original:
Inserts bool value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
挿入ファイルの終わり状態を出力(num_put::put())中に発生した場合put().failed() == trueを呼び出すことにより、汎用ポインタ値は、ios::badbit設定.
Original:
Inserts a generic pointer value by calling num_put::put() If the end of file condition was encountered during output (put().failed() == true), sets ios::badbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
sbからの挿入は、すべてのデータ。 sbnullポインタの場合監視オブジェクトを構築した後、チェックします。それがある場合は、setstate(badbit)と出口を実行します。そうでない場合は、以下の条件を満たされているのいずれかの状況になるまでsb*thisにそれらを挿入することによって制御されている入力シーケンスから文字列を抽出します
Original:
Inserts all data from sb. After constructing the sentry object, checks if sb is a null pointer. If it is, executes setstate(badbit) and exits. Otherwise, extracts characters from the input sequence controlled by sb and inserts them into *this until one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • エンド·オブ·ファイルは、入力シーケンスで発生します;
    Original:
    end-of-file occurs on the input sequence;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (挿入される文字が抽出されていない場合には)失敗出力シーケンスに挿入する;
    Original:
    inserting in the output sequence fails (in which case the character to be inserted is not extracted);
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 例外(例外がキャッチされている場合)に発生.
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
文字が挿入されなかった場合は、setstate(badbit)を実行します。抽出時に例外がスローされた場合は、failbitを設定します
Original:
If no characters were inserted, executes setstate(badbit). If an exception was thrown while extracting, sets failbit
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
func(*this);呼び出します。このオーバーロードは、このようなstd::endlなどのI / Oは、マニピュレータの出力を実装するために使用され.
Original:
Calls func(*this);. This overload is used to implement output I/O manipulators such as std::endl.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

value -
整数、浮動小数点数、boolean、またはポインタ値挿入する
Original:
integer, floating-point, boolean, or pointer value to insert
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
呼び出される関数です
Original:
function to call
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
ポインタがストリームバッファに読み取ることがストリームに
Original:
pointer to the streambuffer to read the data from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

*this

[編集] ノート

揮発性または関数ポインタ(9によって受け入れシグネチャを持つもの以外)のオーバーロード)へのポインタのためのオーバーロードはありません。このようなオブジェクトを出力しようとすると、boolへの暗黙の型変換を起動し、任意の非NULLポインタ値に対して、値1は(boolalphaが設定されていない場合)印刷され.
Original:
There are no overload for pointers to volatile or function pointers (other than the ones with signatures accepted by the 9) overload). Attempting to output such objects invokes implicit conversion to bool, and, for any non-null pointer value, the value 1 is printed (unless boolalpha was set).
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 <iomanip>
#include <sstream>
int main()
{
    std::istringstream input(" \"Some text.\" ");
    volatile int n = 42;
    double f = 3.14;
    bool b = true;;
    std::cout << n   // int overload
              << ' ' // non-member overload
              << std::boolalpha << b // bool overload
              << " " // non-member overload
              << std::fixed << f // double overload
              << input.rdbuf() // streambuf overload
              << &n // bool overload
              << std::endl; // function overload
}

Output:

42 true 3.140000 "Some text." true

[編集] も参照してください

挿入文字データを
Original:
inserts character data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
文字列のストリームI / Oを実行します
Original:
performs stream I/O of strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)
ビット集合のストリームの入力と出力を行います
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数)
複素数をシリアライズしてデシリアライズします
Original:
serializes and deserializes a complex number
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)
擬似乱数エンジンにストリーム入出力を行います
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
擬似乱数分布にストリーム入出力を行います
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
文字を挿入
Original:
inserts a character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
挿入文字のブロックを
Original:
inserts blocks of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]