Bug in ci_string example in web pages
Jonathan Wakely
cow@compsoc.man.ac.uk
Fri Jun 17 14:58:00 GMT 2005
On Fri, Jun 17, 2005 at 04:30:46PM +0200, Giovanni Bajo wrote:
> Jonathan Wakely <cow@compsoc.man.ac.uk> wrote:
>
> > maybe we should just link to www.gotw.ca instead of hosting the message?
> > Then we can punt the responsibility to Herb and ask him to fix it :)
>
> Sounds like a good plan!
Since the website has the wrong code, maybe we should apply the attached
patch, and then link to www.gotw.ca if/when Herb changes it there.
OK for mainline?
* docs/html/21_strings/gotw29a.txt: Update code to corrected version.
jon
-------------- next part --------------
Index: docs/html/21_strings/gotw29a.txt
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/21_strings/gotw29a.txt,v
retrieving revision 1.1
diff -u -p -r1.1 gotw29a.txt
--- docs/html/21_strings/gotw29a.txt 10 Dec 2000 04:04:55 -0000 1.1
+++ docs/html/21_strings/gotw29a.txt 17 Jun 2005 14:54:41 -0000
@@ -119,10 +119,14 @@ the easiest way:
while( n-- > 0 && tolower(*s) != tolower(a) ) {
++s;
}
- return s;
+ return n >= 0 ? s : 0;
}
};
+[N.B. A bug in the original code has been fixed for the
+GCC documentation, the corrected code was taken from
+Herb Sutter's book, Exceptional C++]
+
And finally, the key that brings it all together:
typedef basic_string<char, ci_char_traits> ci_string;
More information about the Libstdc++
mailing list