次の方法で共有


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 の Fill 文字の繰り返しを挿入します。 繰り返しはシーケンスに先行します (_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<<

iostream プログラミング

iostreams の規則