50. Copy constructor and assignment operator of ios_base

Section: 30.5.3 [ios.base] Status: TC1 Submitter: Matt Austern Opened: 1998-06-21 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [ios.base].

View all issues with TC1 status.


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).

Proposed resolution:

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


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