182 {
183#ifndef NDEBUG
184
185
186
187 struct check_buffer_in_use {
188 bool& _buffer_in_use;
189 check_buffer_in_use(bool& buffer_in_use) : _buffer_in_use(buffer_in_use) { assert(!_buffer_in_use); _buffer_in_use = true; }
190 ~check_buffer_in_use() { assert(_buffer_in_use); _buffer_in_use = false; }
191 } buffer_in_use_checker(my->_shared_write_buffer_in_use);
192#endif
193 const size_t write_buffer_size = 2048;
194 if (!my->_shared_write_buffer)
195 my->_shared_write_buffer.reset(
new char[write_buffer_size], [](
char*
p){
delete[]
p; });
196
197 while( size_t bytes_from_rdbuf = static_cast<size_t>(my->_rdbuf.sgetn(my->_shared_write_buffer.get(), write_buffer_size)) )
198 my->_ostr->write( my->_shared_write_buffer, bytes_from_rdbuf );
199 my->_ostr->flush();
200 }