std_sstream.h (str()): Tidy.
authorPaolo Carlini <pcarlini@unitus.it>
Fri, 2 May 2003 23:02:03 +0000 (01:02 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 2 May 2003 23:02:03 +0000 (23:02 +0000)
2003-05-02  Paolo Carlini  <pcarlini@unitus.it>

* include/std/std_sstream.h (str()): Tidy.

From-SVN: r66402

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/std_sstream.h

index 55e7538b39b2f4a0574a5a1e8a566a9a9011a192..cc86e86db3468402c1920f0c9ee7541ab5e15072 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-02  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/std/std_sstream.h (str()): Tidy.
+
 2003-05-02  Nathan Myers  <ncm@cantrip.org>
            Paolo Carlini  <pcarlini@unitus.it>
 
index 1d9a54970c5f279bdd088b8818f6a4d7ed804250..bc11323c721393f0c74684809e6b8841922f35d6 100644 (file)
@@ -133,15 +133,11 @@ namespace std
       __string_type
       str() const
       {
+       const bool __testout = this->_M_mode & ios_base::out;
        __string_type __ret = _M_string;
-       if (this->_M_mode & ios_base::out)
-         {
-           const __size_type __nlen = this->_M_out_lim
-                                       - this->_M_out_beg;
-           if (__nlen)
-             __ret = __string_type(this->_M_out_beg, 
-                                   this->_M_out_beg + __nlen);
-         }
+       if (__testout && this->_M_out_beg < this->_M_out_lim)
+         __ret = __string_type(this->_M_out_beg,
+                               this->_M_out_lim);
        return __ret;
       }