std::ostrstream::~ostrstream (3) - Linux Manuals
std::ostrstream::~ostrstream: std::ostrstream::~ostrstream
Command to display std::ostrstream::~ostrstream
manual in Linux: $ man 3 std::ostrstream::~ostrstream
NAME
std::ostrstream::~ostrstream - std::ostrstream::~ostrstream
Synopsis
virtual ~ostrstream();
Destroys a std::ostrstream object, which also destroys the member std::strstreambuf, which may call the deallocation function if the underlying buffer was dynamically-allocated and not frozen.
Parameters
(none)
Notes
If str() was called on a dynamic ostrstream and freeze(false) was not called after that, this destructor leaks memory.
Example
// Run this code
#include <strstream>
#include <iostream>
int main()
{
{
std::ostrstream s; // dynamic buffer
s << 1.23;
std::cout << s.str() << '\n';
s.freeze(false);
} // destructor called, buffer deallocated
{
std::ostrstream s;
s << 1.23;
std::cout << s.str() << '\n';
// buf.freeze(false);
} // destructor called, memory leaked
}
Output:
1.23
1.23
Pages related to std::ostrstream::~ostrstream
- std::ostrstream::freeze (3) - std::ostrstream::freeze
- std::ostrstream::ostrstream (3) - std::ostrstream::ostrstream
- std::ostrstream::pcount (3) - std::ostrstream::pcount
- std::ostrstream::rdbuf (3) - std::ostrstream::rdbuf
- std::ostrstream::str (3) - std::ostrstream::str
- std::ostrstream (3) - std::ostrstream
- std::ostream (3) - std::basic_ostream
- std::ostream_iterator (3) - std::ostream_iterator
- std::ostream_iterator<T,CharT,Traits>::operator++ (3) - std::ostream_iterator<T,CharT,Traits>::operator++
- std::ostream_iterator<T,CharT,Traits>::operator= (3) - std::ostream_iterator<T,CharT,Traits>::operator=
- std::ostream_iterator<T,CharT,Traits>::ostream_iterator (3) - std::ostream_iterator<T,CharT,Traits>::ostream_iterator
- std::ostream_iterator<T,CharT,Traits>::~ostream_iterator (3) - std::ostream_iterator<T,CharT,Traits>::~ostream_iterator
- std::ostreambuf_iterator (3) - std::ostreambuf_iterator