1446. Move and swap for I/O streams

Section: 30.7 [iostream.format] Status: NAD Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [iostream.format].

View all issues with NAD status.

Discussion:

Addresses US-138

For istreams and ostreams, the move-constructor does not move-construct, the move-assignment operator does not move-assign, and the swap function does not swap because these operations do not manage the rdbuf() pointer. Useful applications of these operations are prevented both by their incorrect semantics and because they are protected.

[ Resolution proposed by ballot comment: ]

In short: reverse the resolution of issue 900, then change the semantics to move and swap the rdbuf() pointer. Add a new protected constructor that takes an rvalue reference to a stream and a pointer to a streambuf, a new protected assign() operator that takes the same arguments, and a new protected partial_swap() function that doesn't swap rdbuf(). See Appendix 1 - Additional Details

[ 2010-10-24 Daniel adds: ]

Accepting n3179 would solve this issue.

[ 2010-11 Batavia ]

Closed as NAD.

The Library Working Group reviewed n3179 and concluded that this change alone was not sufficient, as it would require changes to some of the derived stream types in the library. The preference is to not make such a broad fix, and retain the current semantics. This is closed as NAD rather than NAD future as it will be difficult to rename the new functions introduced in the C++0x revision of the standard at a later date.

Proposed resolution: