Namespaces
Variants

std::basic_osyncstream<CharT,Traits,Allocator>:: get_wrapped

From cppreference.net
streambuf_type * get_wrapped ( ) const noexcept ;
HTMLタグ、属性、C++コードはそのまま保持し、テキスト部分のみ日本語に翻訳しました。

ラップされた std::basic_streambuf へのポインタを返します。これは基盤となる std::basic_syncbuf に対して get_wrapped() を呼び出すことで取得されます。

パラメータ

(なし)

ラップされたバッファは、異なる同期出力ストリームで安全に再ラップできます。

#include <iostream>
#include <syncstream>
int main()
{
    std::osyncstream bout1(std::cout);
    bout1 << "Hello, ";
    {
        std::osyncstream(bout1.get_wrapped()) << "Goodbye, " << "Planet!" << '\n';
    } // emits the contents of the temporary buffer
    bout1 << "World!" << '\n';
} // emits the contents of bout1

出力:

Goodbye, Planet!
Hello, World!

関連項目

basic_osyncstream を破棄し、内部バッファを出力する
(public member function)
ラップされたstreambufポインタを取得する
( std::basic_syncbuf<CharT,Traits,Allocator> のpublic member function)