Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 1.08 KB

op_ostream.md

File metadata and controls

53 lines (42 loc) · 1.08 KB

operator<<

  • string[meta header]
  • std[meta namespace]
  • function template[meta id-type]
namespace std {
  template<class CharT, class Traits, class Allocator>
  std::basic_ostream<CharT, Traits>&
    operator<<(std::basic_ostream<CharT, Traits>& os,
               const basic_string<CharT, Traits, Allocator>& s);
}

概要

文字列をストリームへ出力する。

効果

  1. sentryオブジェクトを構築する。sentryオブジェクトが失敗を示した場合、何もしない。
  2. 仮引数sが指し示す文字列を出力する。
    • width()flags() & (ios_base::adjustfield)に従ってパディングの出力も行う。
  3. width(0)を呼び出す。

戻り値

os

#include <iostream>
#include <string>

int main() {
  std::string s = "Tuna";
  std::cout << s << std::endl;
}

出力例

Tuna

実装例

TBD

バージョン

言語

  • C++98

参照