Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

238. Contradictory results of stringbuf initialization.

Section: 31.8.2.2[stringbuf.cons]Status:CD1Submitter: Dietmar KühlOpened: 2000-05-11Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [stringbuf.cons].

View all issues withCD1 status.

Discussion:

In 27.7.1.1 paragraph 4 the results of calling the constructor of'basic_stringbuf' are said to bestr() == str. This is finethat far but consider this code:

  std::basic_stringbuf<char> sbuf("hello, world", std::ios_base::openmode(0));  std::cout << "'" << sbuf.str() << "'\n";

Paragraph 3 of 27.7.1.1 basically says that in this case neitherthe output sequence nor the input sequence is initialized andparagraph 2 of 27.7.1.2 basically says thatstr() eitherreturns the input or the output sequence. None of them is initialized,ie. both are empty, in which case the return fromstr() isdefined to bebasic_string<cT>().

However, probably only test cases in some testsuites will detect this"problem"...

Proposed resolution:

Remove 27.7.1.1 paragraph 4.

Rationale:

We could fix 27.7.1.1 paragraph 4, but there would be no point. Ifwe fixed it, it would say just the same thing as text that's alreadyin the standard.


[8]ページ先頭

©2009-2026 Movatter.jp