[libstdc++] Notes on specializing char_traits for basic_string<arbitrary-stuff>
Phil Edwards
phil@jaj.com
Fri Oct 11 23:18:00 GMT 2002
On Fri, Oct 11, 2002 at 12:15:43PM +0100, Jonathan Wakely wrote:
> This patch fixes up the XHTML from the above commit, correcting the
> nesting of the <p> and <pre> elements.
Thanks muchly. I fear I will never remember this rule... seems everything
had to be nested to pass the old HTML validators, now everything has to
/not/ be nested to pass the XHTML validators. :-)
> Also, I see that the XHTML headers aren't on the docs on the HEAD branch,
> although they're on the online versions. I thought they'd been checked in
> to CVS?
Yep, they have. Are you updating from subversions.gnu.org? They've been
having problems keep up to date in the last week.
I ended up applying this by hand, and changed the wording as Gaby suggested.
2002-10-12 Jonathan Wakely <jw@kayari.org>
Gabriel Dos Reis <gdr@integrable-solutions.net>
* docs/html/21_strings/howto.html#5: Correct nasting of XHTML
elements. Correct allocator-related text.
Index: docs/html/21_strings/howto.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/21_strings/howto.html,v
retrieving revision 1.14
diff -u -3 -p -r1.14 howto.html
--- docs/html/21_strings/howto.html 10 Oct 2002 22:00:29 -0000 1.14
+++ docs/html/21_strings/howto.html 12 Oct 2002 06:13:16 -0000
@@ -350,26 +350,28 @@
<p>That's the theory. Remember however that basic_string has additional
type parameters, which take default arguments based on the character
type (called CharT here):
- <pre>
+ </p>
+ <pre>
template <typename CharT,
typename Traits = char_traits<CharT>,
typename Alloc = allocator<CharT> >
class basic_string { .... };</pre>
- Now, <code>allocator<CharT></code> will probably Do The Right
- Thing by default, unless you need to do something very strange with
- memory allocation in your characters.
+ <p>Now, <code>allocator<CharT></code> will probably Do The Right
+ Thing by default, unless you need to implement your own allocator
+ for your characters.
</p>
<p>But <code>char_traits</code> takes more work. The char_traits
template is <em>declared</em> but not <em>defined</em>.
That means there is only
- <pre>
+ </p>
+ <pre>
template <typename CharT>
struct char_traits
{
static void foo (type1 x, type2 y);
...
};</pre>
- and functions such as char_traits<CharT>::foo() are not
+ <p>and functions such as char_traits<CharT>::foo() are not
actually defined anywhere for the general case. The C++ standard
permits this, because writing such a definition to fit all possible
CharT's cannot be done. (For a time, in earlier versions of GCC,
More information about the Libstdc++
mailing list