* docs/html/21_strings/gotw29a.txt: Update code to corrected version.

From-SVN: r101130
This commit is contained in:
Jonathan Wakely 2005-06-17 17:26:13 +01:00
parent 853a4203b7
commit 0ec56ba325
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2005-06-17 Jonathan Wakely <redi@gcc.gnu.org>
* docs/html/21_strings/gotw29a.txt: Update code to corrected version.
2005-06-17 Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>

View file

@ -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;