Title
Copy constructor and assignment operator of ios_base
Status
tc1
Section
[ios.base]
Submitter
Matt Austern

Created on 1998-06-21.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

The LWG believes the difficulty of specifying correct semantics outweighs any benefit of allowing ios_base objects to be copyable.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [ios.base], class ios_base, specify the copy constructor and operator= members as being private.

Date: 1998-06-21.00:00:00

As written, ios_base has a copy constructor and an assignment operator. (Nothing in the standard says it doesn't have one, and all classes have copy constructors and assignment operators unless you take specific steps to avoid them.) However, nothing in 27.4.2 says what the copy constructor and assignment operator do.

My guess is that this was an oversight, that ios_base is, like basic_ios, not supposed to have a copy constructor or an assignment operator.

Jerry Schwarz comments: Yes, its an oversight, but in the opposite sense to what you're suggesting. At one point there was a definite intention that you could copy ios_base. It's an easy way to save the entire state of a stream for future use. As you note, to carry out that intention would have required a explicit description of the semantics (e.g. what happens to the iarray and parray stuff).

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg116
2010-10-21 18:28:33adminsetmessages: + msg115
1998-06-21 00:00:00admincreate