PATCH : basic_fstream::is_open()

Richard Andrews richarda@ixla.com.au
Mon Jan 15 19:34:00 GMT 2001


Hi all,

inheriting from fstream I've noticed that is_open() is not const for basic_ofstream, basic_ifstream and basic_fstream. I think these members should be const.
The following is a patch to bits/std_fstream.h taken from the 20010115 codesourcery build



Can someone please verify this and check it in?

Rich


diff -u orig.std_fstream.h std_fstream.h 

--- orig.std_fstream.h	Tue Jan 16 14:17:19 2001
+++ std_fstream.h	Tue Jan 16 14:18:16 2001
@@ -267,7 +267,7 @@
       { return static_cast<__filebuf_type*>(_M_streambuf); }
 
       bool 
-      is_open(void) { return rdbuf()->is_open(); }
+      is_open(void) const { return rdbuf()->is_open(); }
 
       void 
       open(const char* __s, ios_base::openmode __mode = ios_base::in)
@@ -324,7 +324,7 @@
       { return static_cast<__filebuf_type*>(_M_streambuf); }
  
       bool 
-      is_open(void) { return rdbuf()->is_open(); }
+      is_open(void) const { return rdbuf()->is_open(); }
 
       void 
       open(const char* __s, 
@@ -383,7 +383,7 @@
       { return static_cast<__filebuf_type*>(_M_streambuf); }
 
       bool 
-      is_open(void) { return rdbuf()->is_open(); }
+      is_open(void) const { return rdbuf()->is_open(); }
 
       void 
       open(const char* __s, 






More information about the Libstdc++ mailing list