45. Stringstreams read/write pointers initial position unclear

Section: 31.8.4 [ostringstream] Status: NAD Submitter: Matthias Mueller Opened: 1998-05-27 Last modified: 2016-01-28

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 31.3 [iostream.forward], 31.8.4.2 [ostringstream.cons], 31.8.2.2 [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.