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

履歴 編集

function
<syncstream>

std::basic_osyncstream::get_wrapped(C++20)

streambuf_type* get_wrapped() const noexcept;

概要

プライベートメンバのstd::basic_syncbufに、ラップされたstd::basic_streambufへのポインタを取得する。

戻り値

プライベートメンバのstd::basic_syncbufのメンバ関数get_wrapped()を呼び出した結果を返す。

例外

投げない。

get_wrapped()でラップされたストリームバッファを取得することで、それをosyncstreamで再度ラップすることができる。

#include <syncstream>
#include <iostream>

int main()
{
  std::osyncstream bout1(std::cout);
  bout1 << "Hello, ";
  {
    std::osyncstream(bout1.get_wrapped()) << "Goodbye, " << "Planet!" << '\n';
  }
  bout1 << "World!" << '\n';
}

出力

Goodbye, Planet!
Hello, World!

バージョン

言語

  • C++20

処理系

参照