Annex D (normative) Compatibility features [depr]

D.15 char* streams [depr.str.strstreams]

D.15.4 Class ostrstream [depr.ostrstream]

D.15.4.1 General [depr.ostrstream.general]

namespace std { class ostrstream : public basic_ostream<char> { public: ostrstream(); ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out); virtual ~ostrstream(); strstreambuf* rdbuf() const; void freeze(bool freezefl = true); char* str(); int pcount() const; private: strstreambuf sb; // exposition only }; }
The class ostrstream supports the writing of objects of class strstreambuf.
It supplies a strstreambuf object to control the associated array object.
For the sake of exposition, the maintained data is presented here as:
  • sb, the strstreambuf object.

D.15.4.2 ostrstream constructors [depr.ostrstream.cons]

ostrstream();
Effects: Initializes the base class with ostream(&sb) and sb with strstreambuf().
ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
Effects: Initializes the base class with ostream(&sb), and sb with one of two constructors:
  • If (mode & app) == 0, then s shall designate the first element of an array of n elements.
    The constructor is strstreambuf(s, n, s).
  • If (mode & app) != 0, then s shall designate the first element of an array of n elements that contains an ntbs whose first element is designated by s.
    The constructor is strstreambuf(s, n, s + std​::​strlen(s)).307
307)307)
The function signature strlen(const char*) is declared in <cstring>.

D.15.4.3 Member functions [depr.ostrstream.members]

strstreambuf* rdbuf() const;
Returns: (strstreambuf*)&sb.
void freeze(bool freezefl = true);
Effects: Calls rdbuf()->freeze(freezefl).
char* str();
Returns: rdbuf()->str().
int pcount() const;
Returns: rdbuf()->pcount().