GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::ostrstream::~ostrstream(3) C++ Standard Libary std::ostrstream::~ostrstream(3)

std::ostrstream::~ostrstream - std::ostrstream::~ostrstream


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.


(none)


If str() was called on a dynamic ostrstream and freeze(false) was not called after
that, this destructor leaks memory.

// 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
}


1.23
1.23

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.