45. Stringstreams read/write pointers initial position unclear

Section: 30.8.4 [ostringstream] Status: NAD Submitter: Matthias Mueller Opened: 1998-05-27 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [ostringstream].

View all issues with NAD status.

Discussion:

In a comp.lang.c++.moderated Matthias Mueller wrote:

"We are not sure how to interpret the CD2 (see 30.3 [iostream.forward], 30.8.4.1 [ostringstream.cons], 30.8.2.1 [stringbuf.cons]) with respect to the question as to what the correct initial positions of the write and  read pointers of a stringstream should be."

"Is it the same to output two strings or to initialize the stringstream with the first and to output the second?"

[PJ Plauger, Bjarne Stroustrup, Randy Smithey, Sean Corfield, and Jerry Schwarz have all offered opinions; see reflector messages lib-6518, 6519, 6520, 6521, 6523, 6524.]

Rationale:

The LWG believes the Standard is correct as written. The behavior of stringstreams is consistent with fstreams, and there is a constructor which can be used to obtain the desired effect. This behavior is known to be different from strstreams.