bfcafa4fbe
2000-12-09 Phil Edwards <pme@sources.redhat.com> Move the HTML-containing subdirs from 'docs' to 'docs/html'. * README: Update the locations of instructions. * docs/doxygen/run_doxygen: New file, stub. * docs/Makefile: Moved... * docs/configopts.html: Likewise. * docs/documentation.html: Likewise. * docs/install.html: Likewise. * docs/lib3styles.css: Likewise. * docs/17_intro/BADNAMES: Likewise. * docs/17_intro/BUGS: Likewise. * docs/17_intro/C++STYLE: Likewise. * docs/17_intro/CHECKLIST: Likewise. * docs/17_intro/COPYING: Likewise. * docs/17_intro/DESIGN: Likewise. * docs/17_intro/HEADER_POLICY: Likewise. * docs/17_intro/PROBLEMS: Likewise. * docs/17_intro/RELEASE-NOTES: Likewise. * docs/17_intro/TODO: Likewise. * docs/17_intro/contribute.html: Likewise. * docs/17_intro/headers_cc.txt: Likewise. * docs/17_intro/howto.html: Likewise. * docs/17_intro/libstdc++-assign.txt: Likewise. * docs/17_intro/organization: Likewise. * docs/17_intro/porting-howto.html: Likewise. * docs/18_support/howto.html: Likewise. * docs/19_diagnostics/howto.html: Likewise. * docs/20_util/howto.html: Likewise. * docs/21_strings/gotw29a.txt: Likewise. * docs/21_strings/howto.html: Likewise. * docs/21_strings/stringtok_h.txt: Likewise. * docs/21_strings/stringtok_std_h.txt: Likewise. * docs/22_locale/codecvt.html: Likewise. * docs/22_locale/ctype.html: Likewise. * docs/22_locale/howto.html: Likewise. * docs/22_locale/locale.html: Likewise. * docs/23_containers/howto.html: Likewise. * docs/23_containers/wrappers_h.txt: Likewise. * docs/24_iterators/howto.html: Likewise. * docs/25_algorithms/howto.html: Likewise. * docs/26_numerics/howto.html: Likewise. * docs/27_io/howto.html: Likewise. * docs/27_io/iostreams_hierarchy.pdf: Likewise. * docs/ext/howto.html: Likewise. * docs/faq/index.html: Likewise. * docs/faq/index.txt: Likewise. * docs/html/Makefile: ...to here. * docs/html/configopts.html: Likewise. * docs/html/documentation.html: Likewise. * docs/html/install.html: Likewise. * docs/html/lib3styles.css: Likewise. * docs/html/17_intro/BADNAMES: Likewise. * docs/html/17_intro/BUGS: Likewise. * docs/html/17_intro/C++STYLE: Likewise. * docs/html/17_intro/CHECKLIST: Likewise. * docs/html/17_intro/COPYING: Likewise. * docs/html/17_intro/DESIGN: Likewise. * docs/html/17_intro/HEADER_POLICY: Likewise. * docs/html/17_intro/PROBLEMS: Likewise. * docs/html/17_intro/RELEASE-NOTES: Likewise. * docs/html/17_intro/TODO: Likewise. * docs/html/17_intro/contribute.html: Likewise. * docs/html/17_intro/headers_cc.txt: Likewise. * docs/html/17_intro/howto.html: Likewise. * docs/html/17_intro/libstdc++-assign.txt: Likewise. * docs/html/17_intro/organization: Likewise. * docs/html/17_intro/porting-howto.html: Likewise. * docs/html/18_support/howto.html: Likewise. * docs/html/19_diagnostics/howto.html: Likewise. * docs/html/20_util/howto.html: Likewise. * docs/html/21_strings/gotw29a.txt: Likewise. * docs/html/21_strings/howto.html: Likewise. * docs/html/21_strings/stringtok_h.txt: Likewise. * docs/html/21_strings/stringtok_std_h.txt: Likewise. * docs/html/22_locale/codecvt.html: Likewise. * docs/html/22_locale/ctype.html: Likewise. * docs/html/22_locale/howto.html: Likewise. * docs/html/22_locale/locale.html: Likewise. * docs/html/23_containers/howto.html: Likewise. * docs/html/23_containers/wrappers_h.txt: Likewise. * docs/html/24_iterators/howto.html: Likewise. * docs/html/25_algorithms/howto.html: Likewise. * docs/html/26_numerics/howto.html: Likewise. * docs/html/27_io/howto.html: Likewise. * docs/html/27_io/iostreams_hierarchy.pdf: Likewise. * docs/html/ext/howto.html: Likewise. * docs/html/faq/index.html: Likewise. * docs/html/faq/index.txt: Likewise. From-SVN: r38166
157 lines
6.3 KiB
HTML
157 lines
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
|
<META NAME="AUTHOR" CONTENT="pme@sources.redhat.com (Phil Edwards)">
|
|
<META NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
|
<META NAME="DESCRIPTION" CONTENT="Notes for the libstdc++ extensions.">
|
|
<META NAME="GENERATOR" CONTENT="vi and eight fingers">
|
|
<TITLE>libstdc++-v3 HOWTO: Extensions</TITLE>
|
|
<LINK REL=StyleSheet HREF="../lib3styles.css">
|
|
<!-- $Id: howto.html,v 1.4 2000/12/03 23:47:49 jsm28 Exp $ -->
|
|
</HEAD>
|
|
<BODY>
|
|
|
|
<H1 CLASS="centered"><A NAME="top">Extensions</A></H1>
|
|
|
|
<P>Here we will make an attempt at describing the non-Standard extensions to
|
|
the library. Some of these are from SGI's STL, some of these are GNU's,
|
|
and some just seemed to appear on the doorstep.
|
|
</P>
|
|
<P><B>Before you leap in and use these</B>, be aware of two things:
|
|
<OL>
|
|
<LI>Non-Standard means exactly that. The behavior, and the very
|
|
existence, of these extensions may change with little or no
|
|
warning. (Ideally, the really good ones will appear in the next
|
|
revision of C++.) Also, other platforms, other compilers, other
|
|
versions of g++ or libstdc++-v3 may not recognize these names, or
|
|
treat them differently, or...
|
|
<LI>You should know how to <A HREF="../faq/index.html#5_4">access
|
|
these headers properly</A>.
|
|
</OL>
|
|
</P>
|
|
|
|
|
|
<!-- ####################################################### -->
|
|
<HR>
|
|
<H1>Contents</H1>
|
|
<UL>
|
|
<LI><A HREF="#1">Ropes and trees and hashes, oh my!</A>
|
|
<LI><A HREF="#2">Added members</A>
|
|
<LI><A HREF="#3">Allocators</A>
|
|
</UL>
|
|
|
|
<HR>
|
|
|
|
<!-- ####################################################### -->
|
|
|
|
<H2><A NAME="1">Ropes and trees and hashes, oh my!</A></H2>
|
|
<P>The SGI headers
|
|
<PRE>
|
|
<bvector>
|
|
<hash_map>
|
|
<hash_set>
|
|
<rope>
|
|
<slist>
|
|
<tree>
|
|
</PRE> are all here; <TT><bvector></TT> exposes the old bit_vector
|
|
class that was used before specialization of vector<bool> was
|
|
available. <TT><hash_map></TT> and <TT><hash_set></TT>
|
|
are discussed further below. <TT><rope></TT> is the SGI
|
|
specialization for large strings ("rope," "large
|
|
strings," get it? love those SGI folks).
|
|
<TT><slist></TT> is a singly-linked list, for when the
|
|
doubly-linked <TT>list<></TT> is too much space overhead, and
|
|
<TT><tree></TT> exposes the red-black tree classes used in the
|
|
implementation of the standard maps and sets.
|
|
</P>
|
|
<P>Okay, about those hashing classes... I'm going to foist most of the
|
|
work off onto SGI's own site.
|
|
</P>
|
|
<P>Each of the associative containers map, multimap, set, and multiset
|
|
have a counterpart which uses a
|
|
<A HREF="http://www.sgi.com/Technology/STL/HashFunction.html">hashing
|
|
function</A> to do the arranging, instead of a strict weak ordering
|
|
function. The classes take as one of their template parameters a
|
|
function object that will return the hash value; by default, an
|
|
instantiation of
|
|
<A HREF="http://www.sgi.com/Technology/STL/hash.html">hash</A>.
|
|
You should specialize this functor for your class, or define your own,
|
|
before trying to use one of the hashing classes.
|
|
</P>
|
|
<P>The hashing classes support all the usual associative container
|
|
functions, as well as some extra constructors specifying the number
|
|
of buckets, etc.
|
|
</P>
|
|
<P>Why would you want to use a hashing class instead of the
|
|
"normal" implementations? Matt Austern writes:
|
|
<BLOCKQUOTE><EM>[W]ith a well chosen hash function, hash tables
|
|
generally provide much better average-case performance than binary
|
|
search trees, and much worse worst-case performance. So if your
|
|
implementation has hash_map, if you don't mind using nonstandard
|
|
components, and if you aren't scared about the possibility of
|
|
pathological cases, you'll probably get better performance from
|
|
hash_map.</EM></BLOCKQUOTE>
|
|
</P>
|
|
<P>(Side note: for those of you wondering, <B>"Why wasn't a hash
|
|
table included in the Standard in the first #!$@ place?"</B> I'll
|
|
give a quick answer: it was proposed, but too late and in too
|
|
unorganized a fashion. Some sort of hashing will undoubtably be
|
|
included in a future Standard.
|
|
</P>
|
|
<P>Return <A HREF="#top">to top of page</A> or
|
|
<A HREF="../faq/index.html">to the FAQ</A>.
|
|
</P>
|
|
|
|
<HR>
|
|
<H2><A NAME="2">Added members</A></H2>
|
|
<P>Some of the classes in the Standard Library have additional
|
|
publicly-available members. Of those, some are intended purely for
|
|
the implementors, for example, additional typedefs. Those won't be
|
|
described here (or anywhere else). This list will grow slowly, since
|
|
we expect it to be rare -- most extensions will be self-contained.
|
|
</P>
|
|
<P>
|
|
<UL>
|
|
<LI><TT>filebuf</TT>s have another ctor with this signature:<BR>
|
|
<TT>basic_filebuf(int __fd, const char* __name, ios_base::openmode __mode);</TT>
|
|
<BR>This comes in very handy in a number of places, such as
|
|
attaching Unix sockets, pipes, and anything else which uses file
|
|
descriptors, into the IOStream buffering classes. The three
|
|
arguments are as follows:<BR>
|
|
<TT>int __fd, </TT>// open file descriptor<BR>
|
|
<TT>const char* __name, </TT><BR>
|
|
<TT>ios_base::openmode __mode </TT>// same as the other openmode uses
|
|
</UL>
|
|
</P>
|
|
<P>Return <A HREF="#top">to top of page</A> or
|
|
<A HREF="../faq/index.html">to the FAQ</A>.
|
|
</P>
|
|
|
|
<HR>
|
|
<H2><A NAME="3">Allocators</A></H2>
|
|
<P>This will be blank for a while. It will describe all of the different
|
|
memory allocators, most inherited from SGI's code. Input is solicited.
|
|
</P>
|
|
<P>Return <A HREF="#top">to top of page</A> or
|
|
<A HREF="../faq/index.html">to the FAQ</A>.
|
|
</P>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ####################################################### -->
|
|
|
|
<HR>
|
|
<P CLASS="fineprint"><EM>
|
|
Comments and suggestions are welcome, and may be sent to
|
|
<A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or
|
|
<A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>.
|
|
<BR> $Id: howto.html,v 1.4 2000/12/03 23:47:49 jsm28 Exp $
|
|
</EM></P>
|
|
|
|
|
|
</BODY>
|
|
</HTML>
|