Spec-Zone.ru › C++

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

streambuf_type* get_wrapped() const noexcept;

Возвращает указатель на обернутый std::basic_streambuf, полученный вызовом get_wrapped() для базового std::basic_syncbuf.

Параметры

(нет)

Пример

Обёрнутый буфер можно безопасно обернуть в другой синхронизированный поток вывода.

#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 и выводит его внутренний буфер
(публичный член-функция)
get_wrapped
извлекает указатель на обернутый streambuf
(публичный член-функция std::basic_syncbuf<CharT,Traits,Allocator>)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/io/basic_osyncstream/get_wrapped

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API