Share via


operator<< (<ostream>)

ストリームにさまざまな型を記述します。

template<class _Elem, class _Tr>
   basic_ostream<_Elem, _Tr>& operator<<(
      basic_ostream<_Elem, _Tr>& _Ostr,
      const Elem *_Str
   );
template<class _Elem, class _Tr>
   basic_ostream<_Elem, _Tr>& operator<<(
      basic_ostream<_Elem, _Tr>& _Ostr,
      Elem _Ch
   );
template<class _Elem, class _Tr>
   basic_ostream<_Elem, _Tr>& operator<<(
      basic_ostream<_Elem, _Tr>& _Ostr,
      const char *_Str
   );
template<class _Elem, class _Tr>
   basic_ostream<_Elem, _Tr>& operator<< (
      basic_ostream<_Elem, _Tr>& _Ostr,
      char _Ch
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<< (
      basic_ostream<char, _Tr>& _Ostr,
      const char *_Str
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<< (
      basic_ostream<char, _Tr>& _ostr,
      char _Ch
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      const signed char *_Str
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      signed char _Ch
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      const unsigned char *_Str
   );
template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      unsigned char _Ch
   );
template<class _Elem, class _Tr, class _Ty>
    basic_ostream<_Elem, _Tr>& operator<<(
        basic_ostream<_Elem, _Tr>&& _Ostr,
        Ty _Val
    );

パラメーター

  • _Ch
    文字。

  • _Elem
    要素の型。

  • _Ostr
    basic_ostream オブジェクト。

  • _Str
    文字列。

  • _Tr
    文字セット。

  • _Val

戻り値

ストリーム。

解説

basic_ostream のクラスには、いくつかの挿入演算子を定義します。詳細については、「basic_ostream::operator<<」を参照してください。

テンプレート関数

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _ostr,
      const Elem *_Str);

_Str長さで N = シーケンスの最初の traits_type::長さ_Str ()、および挿入をシーケンスを判定します。N < _Ostr.も、関数 _Ostr.width - N の塗りつぶし文字の繰り返しを挿入します。繰り返しは、シーケンスに先行します (_Ostr。フラグの & adjustfield ! = 。それ以外の場合は、繰り返しは、シーケンスに従います。関数は _Ostrを返します。

テンプレート関数

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      Elem _Ch);

要素 _Chを挿入します。1 は、< _Ostr.width、関数 _Ostr.width の繰り返し - 1 の塗りつぶし文字が挿入されます。繰り返し _Ostr.flags & adjustfield != left場合は、シーケンスに続きます。それ以外の場合は、繰り返しは、シーケンスに従います。_Ostr が返されます。

テンプレート関数

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      const char *_Str);

と同様に動作します

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      const Elem *_Str);

ただし、_Str のシーケンスの先頭の各要素 _Ch は Elem 型のオブジェクトに _Ostr.設定 (_Ostr.配分します_Ch () を呼び出します) によって変換されます。

テンプレート関数

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      char _Ch);

と同様に動作します

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      Elem _Ch);

ただし、_Ch は Elem 型のオブジェクトに _Ostr.put (_Ostr.widen_Ch () を呼び出します) によって変換されます。

テンプレート関数

template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      const char *_Str);

と同様に動作します

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      const Elem *_Str);

つまり、それらを挿入する前に、要素を拡大する必要はありません)。

テンプレート関数

template<class _Tr>
   basic_ostream<char, Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      char _Ch);

と同様に動作します

template<class _Elem, class _Tr>
   basic_ostream<Elem, _Tr>& operator<<(
      basic_ostream<Elem, _Tr>& _Ostr,
      Elem _Ch);

(これを挿入する前に _Ch を拡大する必要はありません)。

テンプレート関数

template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      const signed char *_Str);

_Ostr を << (const char *) _Str返します。

テンプレート関数

template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      signed char _Ch);

_Ostr を << (char) _Ch返します。

このテンプレート関数は:

template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      const unsigned char *_Str);

_Ostr を << (const char *) _Str返します。

このテンプレート関数は:

template<class _Tr>
   basic_ostream<char, _Tr>& operator<<(
      basic_ostream<char, _Tr>& _Ostr,
      unsigned char _Ch);

_Ostr を << (char) _Ch返します。

このテンプレート関数は:

template<class _Elem, class _Tr, class _Ty>
    basic_ostream<_Elem, _Tr>& operator<<(
        basic_ostream<char, _Tr>&& _Ostr,
        _Ty _Val
    );

_Ostr<<_Val 返します (および変換プロセスの左辺値への _Ostr への RValue の参照 )。

使用例

**operator<<**の使用例については フラッシュ を参照してください。

必要条件

ヘッダー: <ostream>

名前空間: std

参照

関連項目

basic_ostream::operator<<

入出力ストリームのプログラミング

入出力ストリームの規則