S
sylcheung
Hi,
I am new to STL, and I have a memory allocation regarding using
ostringstream in STL.
I have a class called 'Rect' and it has a method like this:
string Rect::toString() {
ostringstream ost;
ost << "x:" << x;
ost << " y:" << y;
ost << " w:" << w;
ost << " h:" << h;
return ost.str();
}
And in my program, I call toString() like this:
Rect r;
cout << r.toString();
my question is who free up the memory used by the string return by
ost.str()?
Thank you.
I am new to STL, and I have a memory allocation regarding using
ostringstream in STL.
I have a class called 'Rect' and it has a method like this:
string Rect::toString() {
ostringstream ost;
ost << "x:" << x;
ost << " y:" << y;
ost << " w:" << w;
ost << " h:" << h;
return ost.str();
}
And in my program, I call toString() like this:
Rect r;
cout << r.toString();
my question is who free up the memory used by the string return by
ost.str()?
Thank you.