This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 27 [input.output] Status: CD1 Submitter: Walter Brown, Marc Paterno Opened: 2002-05-10 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [input.output].
View all issues with CD1 status.
Some stream and streambuf member functions are declared non-const, even thought they appear only to report information rather than to change an object's logical state. They should be declared const. See document N1360 for details and rationale.
The list of member functions under discussion: in_avail, showmanyc, tellg, tellp, is_open.
Related issue: 73
In 188.8.131.52, 184.108.40.206, 220.127.116.11, 18.104.22.168, 22.214.171.124, and 126.96.36.199
bool is_open() const;
Of the changes proposed in N1360, the only one that is safe is changing the filestreams' is_open to const. The LWG believed that this was NAD the first time it considered this issue (issue 73), but now thinks otherwise. The corresponding streambuf member function, after all,is already const.
The other proposed changes are less safe, because some streambuf functions that appear merely to report a value do actually perform mutating operations. It's not even clear that they should be considered "logically const", because streambuf has two interfaces, a public one and a protected one. These functions may, and often do, change the state as exposed by the protected interface, even if the state exposed by the public interface is unchanged.
Note that implementers can make this change in a binary compatible way by providing both overloads; this would be a conforming extension.