最終更新日時(UTC):
が更新

履歴 編集

function
<syncstream>

std::basic_syncbuf::rdbuf(C++20)

syncbuf_type* rdbuf() const noexcept;

概要

ベースとなるstd::basic_syncbufへのポインタを返す。

戻り値

ベースとなるプライベートメンバのstd::basic_syncbufsbとすると、次と等価である。 const_cast<syncbuf_type*>(std::addressof(sb));

例外

投げない。

#include <syncstream>
#include <iostream>

int main()
{
  std::osyncstream bout(std::cout);
  bout1 << "Hello, ";

  auto syncbuf_ptr = bout.rdbuf();
  syncbuf_ptr->emit(); // 文字が転送される

  bout << "World!" << '\n';
}

出力

Hello, World!

バージョン

言語

  • C++20

処理系

参照