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);

确定该长度N = traits_type::长度(_Str)序列开头在 _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);

但序列开头的每个元素 _Ch 在 _Str 的将转换为类型 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<;AMP_lt;_Val (和转换为 _Ostr 的 RValue引用 到进程中的一个左值)。

示例

使用 **operator<;AMP_lt;**有关示例,请参见 刷新

要求

标头: <ostream>

命名空间: std

请参见

参考

basic_ostream::operator<<

iostream编程

(mfc)约定