Movatterモバイル変換


[0]ホーム

URL:



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

1249.basic_ios default ctor

Section: 31.5.4.2[basic.ios.cons]Status:C++11Submitter: Martin SeborOpened: 2009-10-25Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [basic.ios.cons].

View all issues withC++11 status.

Discussion:

Thebasic_ios default ctor is required to leave the objects membersuninitialized (see below). The paragraph says the object must beinitialized by callingbasic_ios::init() before it's destroyed butI can't find a requirement that it be initialized before callingany of the class other member functions. Am I not looking in theright place or that an issue?

[2009-10-25 Daniel adds:]

I agree, that your wording makes that clearer, but suggest to write

... callingbasic_ios::init() before ...

Doing so, I recommend to adapt that ofios_base(); as well, wherewe have:

Effects: Eachios_base member has an indeterminate valueafter construction. These members shall be initialized by callingbasic_ios::init. If anios_base object is destroyedbefore these initializations have taken place, the behavior isundefined.

[Post-Rapperswil:]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

[Adopted at 2010-11 Batavia]

Proposed resolution:

Change 31.5.2.8[ios.base.cons] p1:

ios_base();

Effects: Eachios_base member has an indeterminate valueafter construction.TheseThe object's members shall be initialized by callingbasic_ios::initbefore the object's first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined..If anios_base object is destroyedbefore these initializations have taken place, the behavior isundefined.

Change 31.5.4.2[basic.ios.cons] p2:

basic_ios();

Effects: Constructs an object of classbasic_ios(27.5.2.7) leaving its member objects uninitialized. The object shall beinitialized by callingitsbasic_ios::initbefore its firstuse or before it is destroyed, whichever comes first; otherwise thebehavior is undefined.member function. If it is destroyedbefore it has been initialized the behavior is undefined.


[8]ページ先頭

©2009-2026 Movatter.jp