| 9499 | static StringStreams* s_instance; |
| 9500 | |
| 9501 | auto add() -> std::size_t { |
| 9502 | if( m_unused.empty() ) { |
| 9503 | m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) ); |
| 9504 | return m_streams.size()-1; |
| 9505 | } |
| 9506 | else { |
| 9507 | auto index = m_unused.back(); |
| 9508 | m_unused.pop_back(); |
| 9509 | return index; |
| 9510 | } |
| 9511 | } |
| 9512 | |
| 9513 | void release( std::size_t index ) { |
| 9514 | m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state |