configopts.html: More HTML->XHTML and lowercasing of tags.
2001-10-09 Phil Edwards <pme@gcc.gnu.org> * docs/html/configopts.html: More HTML->XHTML and lowercasing of tags. * docs/html/documentation.html: Likewise. * docs/html/explanations.html: Likewise. * docs/html/install.html: Likewise. * docs/html/17_intro/howto.html: Likewise. * docs/html/17_intro/license.html: Likewise. Tighten up language. * 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/howto.html: Likewise. * docs/html/22_locale/howto.html: Likewise. * docs/html/23_containers/howto.html: 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/ext/howto.html: Likewise. * docs/html/ext/sgiexts.html: Likewise. * docs/html/faq/index.html: Likewise. Not so many absolute links. * docs/html/faq/index.txt: Regenerate. From-SVN: r46128
This commit is contained in:
parent
0d47f08629
commit
0435269a76
21 changed files with 430 additions and 415 deletions
|
@ -1,3 +1,26 @@
|
|||
2001-10-09 Phil Edwards <pme@gcc.gnu.org>
|
||||
|
||||
* docs/html/configopts.html: More HTML->XHTML and lowercasing of tags.
|
||||
* docs/html/documentation.html: Likewise.
|
||||
* docs/html/explanations.html: Likewise.
|
||||
* docs/html/install.html: Likewise.
|
||||
* docs/html/17_intro/howto.html: Likewise.
|
||||
* docs/html/17_intro/license.html: Likewise. Tighten up language.
|
||||
* 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/howto.html: Likewise.
|
||||
* docs/html/22_locale/howto.html: Likewise.
|
||||
* docs/html/23_containers/howto.html: 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/ext/howto.html: Likewise.
|
||||
* docs/html/ext/sgiexts.html: Likewise.
|
||||
* docs/html/faq/index.html: Likewise. Not so many absolute links.
|
||||
* docs/html/faq/index.txt: Regenerate.
|
||||
|
||||
2001-10-07 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* docs/html/22_locale/locale.html, docs/html/faq/index.html: Fix
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, gcc, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for libstdc++ chapter 17.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, gcc, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for libstdc++ chapter 17.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 17</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 17: Library Introduction</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 17: Library Introduction</a></h1>
|
||||
|
||||
<p>Chapter 17 is actually a list of definitions and descriptions used
|
||||
in the following chapters of the Standard when describing the actual
|
||||
|
@ -27,7 +27,7 @@
|
|||
<li><a href="#2">The Standard C++ header files</a>
|
||||
<li><a href="#3">Thread-safety</a>
|
||||
<li><a href="#4"><code><foo></code> vs <code><foo.h></code></a>
|
||||
<li><a href="porting-howto.html">Porting-howto</a>
|
||||
<li><a href="porting-howto.html">Porting HOWTO</a>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
@ -92,9 +92,9 @@
|
|||
an application for high-speed using this implementation of the STL.
|
||||
Here is one possible example displaying the forcing of the malloc-based
|
||||
allocator over the typically higher-speed default allocator:
|
||||
<PRE>
|
||||
<pre>
|
||||
std::list <void*, std::malloc_alloc> my_malloc_based_list;
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>A recent journal article has described "atomic integer
|
||||
operations," which would allow us to, well, perform updates
|
||||
|
@ -177,10 +177,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, license, licence">
|
||||
<meta NAME="DESCRIPTION" CONTENT="Copying restrictions for libstdc++.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="libstdc++, license, licence">
|
||||
<meta name="DESCRIPTION" content="Copying restrictions for libstdc++.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 copying</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Licenses for the Library</a></h1>
|
||||
<h1 class="centered"><a name="top">Licenses for the Library</a></h1>
|
||||
|
||||
<p><strong>As long as this sentence is in place, this page isn't
|
||||
official. It is still experimental if you are reading this.</strong></p>
|
||||
|
||||
<p>There are two licenses affecting GNU libstdc++-v3: one for the code, and
|
||||
one for the documentation. Here we will describe both of them, and try
|
||||
to answer some of the common questions. If you have more questions, ask the
|
||||
FSF or the gcc-help mailing list; the person writing this page is a
|
||||
programmer, not a lawyer.
|
||||
to answer some of the widespread questions. If you have more questions,
|
||||
ask the FSF or the
|
||||
<a href="http://gcc.gnu.org/lists.html">gcc mailing list</a>; the person
|
||||
writing this page is a programmer, not a lawyer.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
@ -44,8 +45,7 @@ official. It is still experimental if you are reading this.</strong></p>
|
|||
</p>
|
||||
|
||||
<p>Hopefully that text is self-explanatory. If it isn't, you need to speak
|
||||
to your lawyer, or the Free Software Foundation. I am not a legal expert.
|
||||
I do not even play one on television.
|
||||
to your lawyer, or the Free Software Foundation.
|
||||
</p>
|
||||
|
||||
<!-- Most of the Q&A's are based on, paraphrased from, and outright stolen
|
||||
|
@ -75,15 +75,6 @@ official. It is still experimental if you are reading this.</strong></p>
|
|||
but we won't punish you or sue you if you choose otherwise.
|
||||
</p>
|
||||
|
||||
<!-- Someone would probably shoot me if I uncommented this.
|
||||
<p><strong>Q: I heard that the startup code for libstdc++-v3 detects
|
||||
what license the program uses, and makes my program crash if it isn't
|
||||
an open source license! Is that true?</strong>
|
||||
<br>A: You are paranoid and insane. Please calm down and try switching
|
||||
to decaf.
|
||||
</p>
|
||||
-->
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>The Docs: FDL</h2>
|
||||
|
@ -105,9 +96,11 @@ official. It is still experimental if you are reading this.</strong></p>
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<p class="fineprint"><em>
|
||||
Comments and suggestions about this page are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
Comments or questions about the licenses themselves are also welcome, and
|
||||
should be directed to the GCC list as descibed above.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 18.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 18.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 18</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 18: Library Support</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 18: Library Support</a></h1>
|
||||
|
||||
<p>Chapter 18 deals with the functions called and objects created
|
||||
automatically during the course of a program's existence.
|
||||
|
@ -59,7 +59,7 @@
|
|||
not overload on pointer-vs-integer types to begin with. He also
|
||||
offers a way to make your own magic NULL that will match pointers
|
||||
before it matches integers:
|
||||
<PRE>
|
||||
<pre>
|
||||
const // this is a const object...
|
||||
class {
|
||||
public:
|
||||
|
@ -76,7 +76,7 @@
|
|||
// taken (see Item 27)...
|
||||
|
||||
} NULL; // and whose name is NULL
|
||||
</PRE>(Cribbed from the published version of
|
||||
</pre>(Cribbed from the published version of
|
||||
<a href="http://www.awlonline.com/cseng/meyerscddemo/">the
|
||||
Effective C++ CD</a>, reproduced here with permission.)
|
||||
</p>
|
||||
|
@ -87,7 +87,8 @@
|
|||
<code>foo(0);</code> instead of <code>foo(NULL);</code>, then you're back
|
||||
where you started.
|
||||
</p>
|
||||
<p><B>Added Note:</B> When we contacted Dr. Meyers to ask permission to
|
||||
<p><strong>Added Note:</strong> When we contacted Dr. Meyers to ask
|
||||
permission to
|
||||
print this stuff, it prompted him to run this code through current
|
||||
compilers to see what the state of the art is with respect to member
|
||||
template functions. He posted
|
||||
|
@ -106,12 +107,12 @@
|
|||
<hr>
|
||||
<h2><a name="2">Implementation properties</a></h2>
|
||||
<p>
|
||||
<h3><CODE><limits></CODE></h3>
|
||||
<h3><code><limits></code></h3>
|
||||
This header mainly defines traits classes to give access to various
|
||||
implementation defined-aspects of the fundamental types. The
|
||||
traits classes -- fourteen in total -- are all specilizations of the
|
||||
template class <CODE>numeric_limits</CODE> defined as follows:
|
||||
<PRE>
|
||||
template class <code>numeric_limits</code> defined as follows:
|
||||
<pre>
|
||||
template<typename T> struct class {
|
||||
static const bool is_specialized;
|
||||
static T max() throw();
|
||||
|
@ -147,7 +148,7 @@
|
|||
static const bool traps;
|
||||
static const bool tinyness_before;
|
||||
static const float_round_style round_style;
|
||||
};</PRE>
|
||||
};</pre>
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
<a href="../faq/index.html">to the FAQ</a>.
|
||||
|
@ -171,7 +172,7 @@
|
|||
(This isn't actually new.)
|
||||
<li>The previous two actions are "interleaved," that is,
|
||||
given this pseudocode:
|
||||
<PRE>
|
||||
<pre>
|
||||
extern "C or C++" void f1 (void);
|
||||
extern "C or C++" void f2 (void);
|
||||
|
||||
|
@ -179,7 +180,7 @@
|
|||
atexit(f1);
|
||||
static Thing obj2;
|
||||
atexit(f2);
|
||||
</PRE>then at a call of <code>exit()</code>, f2 will be called, then
|
||||
</pre>then at a call of <code>exit()</code>, f2 will be called, then
|
||||
obj2 will be destroyed, then f1 will be called, and finally obj1
|
||||
will be destroyed. If f1 or f2 allow an exception to propogate
|
||||
out of them, Bad Things happen.
|
||||
|
@ -221,9 +222,9 @@
|
|||
<p>By default, if one of the "throwing <code>new</code>s" can't
|
||||
allocate the memory requested, it tosses an instance of a
|
||||
<code>bad_alloc</code> exception (or, technically, some class derived
|
||||
from it). You can change this by writing your own function (called
|
||||
a new-handler) and then registering it with <code>set_new_handler()</code>:
|
||||
<PRE>
|
||||
from it). You can change this by writing your own function (called a
|
||||
new-handler) and then registering it with <code>set_new_handler()</code>:
|
||||
<pre>
|
||||
typedef void (*PFV)(void);
|
||||
|
||||
static char* safety;
|
||||
|
@ -242,10 +243,10 @@
|
|||
int main ()
|
||||
{
|
||||
safety = new char[500000];
|
||||
old_handler = set_new_handler (&my_new_handler);
|
||||
old_handler = set_new_handler (&my_new_handler);
|
||||
...
|
||||
}
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p><code>bad_alloc</code> is derived from the base <code>exception</code>
|
||||
class defined in Chapter 19.
|
||||
|
@ -256,15 +257,13 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 19.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 19.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 19</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 19: Diagnostics</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 19: Diagnostics</a></h1>
|
||||
|
||||
<p>Chapter 19 deals with program diagnostics, such as exceptions
|
||||
and assertions. You know, all the things we wish weren't even
|
||||
|
@ -38,20 +38,19 @@
|
|||
place). It's good to remember that you can add your own data to
|
||||
these exceptions when extending the heirarchy:
|
||||
</p>
|
||||
<PRE>
|
||||
using std::runtime_error;
|
||||
struct My_Exception : public runtime_error
|
||||
<pre>
|
||||
struct My_Exception : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
My_Exception (const string& whatarg)
|
||||
: runtime_error(whatarg), e(errno), id(GetDataBaseID()) { }
|
||||
: std::runtime_error(whatarg), e(errno), id(GetDataBaseID()) { }
|
||||
int errno_at_time_of_throw() const { return e; }
|
||||
DBID id_of_thing_that_threw() const { return id; }
|
||||
protected:
|
||||
int e;
|
||||
DBID id; // some user-defined type
|
||||
};
|
||||
</PRE>
|
||||
</pre>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
<a href="../faq/index.html">to the FAQ</a>.
|
||||
</p>
|
||||
|
@ -111,10 +110,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 20.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 20.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 20</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 20: General Utilities</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 20: General Utilities</a></h1>
|
||||
|
||||
<p>Chapter 20 deals with utility classes and functions, such as
|
||||
the oft-debated <code>auto_ptr<></code>.
|
||||
|
@ -47,7 +47,7 @@
|
|||
</p>
|
||||
<p>AP <em>is</em> meant to prevent nasty leaks in the presence of
|
||||
exceptions. That's <em>all</em>. This code is AP-friendly:
|
||||
<PRE>
|
||||
<pre>
|
||||
// not a recommend naming scheme, but good for web-based FAQs
|
||||
typedef std::auto_ptr<MyClass> APMC;
|
||||
|
||||
|
@ -62,20 +62,20 @@
|
|||
|
||||
function_taking_MyClass_pointer (ap.get());
|
||||
}
|
||||
</PRE>When an exception gets thrown, the instance of MyClass that's
|
||||
</pre>When an exception gets thrown, the instance of MyClass that's
|
||||
been created on the heap will be <code>delete</code>'d as the stack is
|
||||
unwound past <code>func()</code>.
|
||||
</p>
|
||||
<p>Changing that code as follows is <em>not</em> AP-friendly:
|
||||
<PRE>
|
||||
<pre>
|
||||
APMC ap (new MyClass[22]);
|
||||
</PRE>You will get the same problems as you would without the use
|
||||
</pre>You will get the same problems as you would without the use
|
||||
of AP:
|
||||
<PRE>
|
||||
<pre>
|
||||
char* array = new char[10]; // array new...
|
||||
...
|
||||
delete array; // ...but single-object delete
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>AP cannot tell whether the pointer you've passed at creation points
|
||||
to one or many things. If it points to many things, you are about
|
||||
|
@ -92,12 +92,12 @@
|
|||
<p>All of the <a href="../23_containers/howto.html">containers</a>
|
||||
described in the standard library require their contained types
|
||||
to have, among other things, a copy contructor like this:
|
||||
<PRE>
|
||||
<pre>
|
||||
struct My_Type
|
||||
{
|
||||
My_Type (My_Type const&);
|
||||
};
|
||||
</PRE>
|
||||
</pre>
|
||||
Note the const keyword; the object being copied shouldn't change.
|
||||
The template class <code>auto_ptr</code> (called AP here) does not
|
||||
meet this requirement. Creating a new AP by copying an existing
|
||||
|
@ -106,14 +106,14 @@
|
|||
copy ctors of AP do not take const objects.
|
||||
</p>
|
||||
<p>The resulting rule is simple: <em>Never ever use a container of
|
||||
auto_ptr objects.</em> The standard says that undefined behavior
|
||||
is the result, but it is guaranteed to be messy.
|
||||
auto_ptr objects.</em> The standard says that "undefined"
|
||||
behavior is the result, but it is guaranteed to be messy.
|
||||
</p>
|
||||
<p>To prevent you from doing this to yourself, the
|
||||
<a href="../19_diagnostics/howto.html#3">concept checks</a> built
|
||||
in to this implementation will issue an error if you try to
|
||||
compile code like this:
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
|
@ -121,7 +121,7 @@
|
|||
{
|
||||
std::vector< std::auto_ptr<int> > vec_ap_int;
|
||||
}
|
||||
</PRE>
|
||||
</pre>
|
||||
Should you try this with the checks enabled, you will see an error.
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
|
@ -151,16 +151,16 @@
|
|||
</p>
|
||||
<p>Construction is simple. The default ctor initializes each member
|
||||
with its respective default ctor. The other simple ctor,
|
||||
<PRE>
|
||||
<pre>
|
||||
pair (const T1& x, const T2& y);
|
||||
</PRE>does what you think it does, <code>first</code> getting <code>x</code>
|
||||
</pre>does what you think it does, <code>first</code> getting <code>x</code>
|
||||
and <code>second</code> getting <code>y</code>.
|
||||
</p>
|
||||
<p>There is a copy constructor, but it requires that your compiler
|
||||
handle member function templates:
|
||||
<PRE>
|
||||
<pre>
|
||||
template <class U, class V> pain (const pair<U,V>& p);
|
||||
</PRE>The compiler will convert as necessary from U to T1 and from
|
||||
</pre>The compiler will convert as necessary from U to T1 and from
|
||||
V to T2 in order to perform the respective initializations.
|
||||
</p>
|
||||
<p>The comparison operators are done for you. Equality
|
||||
|
@ -173,10 +173,10 @@
|
|||
<a name="pairlt">
|
||||
<p>The less-than operator is a bit odd the first time you see it. It
|
||||
is defined as evaluating to:
|
||||
<PRE>
|
||||
<pre>
|
||||
x.first < y.first ||
|
||||
( !(y.first < x.first) && x.second < y.second )
|
||||
</PRE>
|
||||
</pre>
|
||||
The other operators are not defined using the <code>rel_ops</code>
|
||||
functions above, but their semantics are the same.
|
||||
</p>
|
||||
|
@ -184,9 +184,9 @@
|
|||
<p>Finally, there is a template function called <code>make_pair</code>
|
||||
that takes two references-to-const objects and returns an
|
||||
instance of a pair instantiated on their respective types:
|
||||
<PRE>
|
||||
<pre>
|
||||
pair<int,MyClass> p = make_pair(4,myobject);
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
<a href="../faq/index.html">to the FAQ</a>.
|
||||
|
@ -198,10 +198,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 21.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 21.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 21</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 21: Strings</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 21: Strings</a></h1>
|
||||
|
||||
<p>Chapter 21 deals with the C++ strings library (a welcome relief).
|
||||
</p>
|
||||
|
@ -59,7 +59,7 @@
|
|||
hierarchy and the string class, and they operate with regular
|
||||
streams seamlessly because they inherit from the iostream
|
||||
heirarchy. An quick example:
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
@ -78,11 +78,11 @@
|
|||
<< " and 3*N was " << (3*the_number);
|
||||
|
||||
return output_stream.str();
|
||||
} </PRE>
|
||||
} </pre>
|
||||
</p></a>
|
||||
<p>A serious problem with CString is a design bug in its memory
|
||||
allocation. Specifically, quoting from that same message:
|
||||
<PRE>
|
||||
<pre>
|
||||
CString suffers from a common programming error that results in
|
||||
poor performance. Consider the following code:
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
|
||||
If you replace CString with string in the above function, the
|
||||
performance is O(n).
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>Joe Buck also pointed out some other things to keep in mind when
|
||||
comparing CString and the Standard string class:
|
||||
|
@ -143,7 +143,7 @@
|
|||
is identical to the standard 'string' class, but is
|
||||
case-insensitive in the same way as the (common but nonstandard)
|
||||
C function stricmp():"
|
||||
<PRE>
|
||||
<pre>
|
||||
ci_string s( "AbCdE" );
|
||||
|
||||
// case insensitive
|
||||
|
@ -152,7 +152,7 @@
|
|||
|
||||
// still case-preserving, of course
|
||||
assert( strcmp( s.c_str(), "AbCdE" ) == 0 );
|
||||
assert( strcmp( s.c_str(), "abcde" ) != 0 ); </PRE>
|
||||
assert( strcmp( s.c_str(), "abcde" ) != 0 ); </pre>
|
||||
</p>
|
||||
|
||||
<p>The solution is surprisingly easy. The original answer pages
|
||||
|
@ -165,7 +165,8 @@
|
|||
here</a>.
|
||||
</p>
|
||||
<p>See? Told you it was easy!</p>
|
||||
<p><B>Added June 2000:</B> The May issue of <U>C++ Report</U> contains
|
||||
<p><strong>Added June 2000:</strong> The May issue of <u>C++ Report</u>
|
||||
contains
|
||||
a fascinating article by Matt Austern (yes, <em>the</em> Matt Austern)
|
||||
on why case-insensitive comparisons are not as easy as they seem,
|
||||
and why creating a class is the <em>wrong</em> way to go about it in
|
||||
|
@ -178,7 +179,7 @@
|
|||
that nobody ever called me on it...) The GotW question and answer
|
||||
remain useful instructional tools, however.
|
||||
</p>
|
||||
<p><B>Added September 2000:</B> James Kanze provided a link to a
|
||||
<p><strong>Added September 2000:</strong> James Kanze provided a link to a
|
||||
<a href="http://www.unicode.org/unicode/reports/tr21/">Unicode
|
||||
Technical Report discussing case handling</a>, which provides some
|
||||
very good information.
|
||||
|
@ -208,20 +209,20 @@
|
|||
comments on what kind of string it will accept). The author uses
|
||||
a more general (but less readable) form of it for parsing command
|
||||
strings and the like. If you compiled and ran this code using it:
|
||||
<PRE>
|
||||
<pre>
|
||||
std::list<string> ls;
|
||||
stringtok (ls, " this \t is\t\n a test ");
|
||||
for (std::list<string>const_iterator i = ls.begin();
|
||||
i != ls.end(); ++i)
|
||||
{
|
||||
std::cerr << ':' << (*i) << ":\n";
|
||||
}</PRE>
|
||||
}</pre>
|
||||
You would see this as output:
|
||||
<PRE>
|
||||
<pre>
|
||||
:this:
|
||||
:is:
|
||||
:a:
|
||||
:test:</PRE>
|
||||
:test:</pre>
|
||||
with all the whitespace removed. The original <code>s</code> is still
|
||||
available for use, <code>ls</code> will clean up after itself, and
|
||||
<code>ls.size()</code> will return how many tokens there were.
|
||||
|
@ -235,7 +236,7 @@
|
|||
with reading the new function names, this version is recommended
|
||||
as an example.
|
||||
</p>
|
||||
<p><B>Added February 2001:</B> Mark Wilden pointed out that the
|
||||
<p><strong>Added February 2001:</strong> Mark Wilden pointed out that the
|
||||
standard <code>std::getline()</code> function can be used with standard
|
||||
<a href="../27_io/howto.html">istringstreams</a> to perform
|
||||
tokenizing as well. Build an istringstream from the input text,
|
||||
|
@ -256,7 +257,7 @@
|
|||
</p>
|
||||
<p>This code will go through some iterations (no pun). Here's the
|
||||
simplistic version usually seen on Usenet:
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cctype> // old <ctype.h>
|
||||
|
@ -273,9 +274,9 @@
|
|||
// result in a different string
|
||||
std::string capital_s;
|
||||
capital_s.reserve(s.size());
|
||||
std::transform (s.begin(), s.end(), capital_s.begin(), tolower); </PRE>
|
||||
<SPAN CLASS="larger"><B>Note</B></SPAN> that these calls all involve
|
||||
the global C locale through the use of the C functions
|
||||
std::transform (s.begin(), s.end(), capital_s.begin(), tolower); </pre>
|
||||
<span class="larger"><strong>Note</strong></span> that these calls all
|
||||
involve the global C locale through the use of the C functions
|
||||
<code>toupper/tolower</code>. This is absolutely guaranteed to work --
|
||||
but <em>only</em> if the string contains <em>only</em> characters
|
||||
from the basic source character set, and there are <em>only</em>
|
||||
|
@ -285,11 +286,11 @@
|
|||
characters (hahahahahaha), then you're done.
|
||||
</p>
|
||||
<p>At minimum, you can write short wrappers like
|
||||
<PRE>
|
||||
<pre>
|
||||
char toLower (char c)
|
||||
{
|
||||
return tolower(static_cast<unsigned char>(c));
|
||||
}</PRE>
|
||||
}</pre>
|
||||
</p>
|
||||
<p>The correct method is to use a facet for a particular locale
|
||||
and call its conversion functions. These are discussed more in
|
||||
|
@ -302,7 +303,7 @@
|
|||
like transformations, this task is trivial with the use of string's
|
||||
<code>find</code> family. These examples are broken into multiple
|
||||
statements for readability:
|
||||
<PRE>
|
||||
<pre>
|
||||
std::string str (" \t blah blah blah \n ");
|
||||
|
||||
// trim leading whitespace
|
||||
|
@ -311,7 +312,7 @@
|
|||
|
||||
// trim trailing whitespace
|
||||
notwhite = str.find_last_not_of(" \t\n");
|
||||
str.erase(notwhite+1); </PRE>
|
||||
str.erase(notwhite+1); </pre>
|
||||
Obviously, the calls to <code>find</code> could be inserted directly
|
||||
into the calls to <code>erase</code>, in case your compiler does not
|
||||
optimize named temporaries out of existance.
|
||||
|
@ -322,14 +323,13 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 22.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 22.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 22</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 22: Localization</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 22: Localization</a></h1>
|
||||
|
||||
<p>Chapter 22 deals with the C++ localization facilities.
|
||||
</p>
|
||||
|
@ -38,18 +38,18 @@
|
|||
|
||||
<hr>
|
||||
<h2><a name="1">class locale</a></h2>
|
||||
<p> Notes made during the implementation of locales can be found
|
||||
<a href="locale.html">here</a>.
|
||||
<p>Notes made during the implementation of locales can be found
|
||||
<a href="locale.html">here</a>.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="2">class codecvt</a></h2>
|
||||
<p> Notes made during the implementation of codecvt can be found
|
||||
<a href="codecvt.html">here</a>.
|
||||
<p>Notes made during the implementation of codecvt can be found
|
||||
<a href="codecvt.html">here</a>.
|
||||
</p>
|
||||
|
||||
<p> The following is the abstract from the implementation notes:
|
||||
<BLOCKQUOTE>
|
||||
<p>The following is the abstract from the implementation notes:
|
||||
<blockquote>
|
||||
The standard class codecvt attempts to address conversions between
|
||||
different character encoding schemes. In particular, the standard
|
||||
attempts to detail conversions between the implementation-defined
|
||||
|
@ -63,18 +63,19 @@
|
|||
requirements are addressed, and examples of correct usage for both
|
||||
the required specializations for wide and narrow characters and the
|
||||
implementation-provided extended functionality are given.
|
||||
</BLOCKQUOTE>
|
||||
</blockquote>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="3">class ctype</a></h2>
|
||||
<p> Notes made during the implementation of ctype can be found
|
||||
<a href="ctype.html">here</a>.
|
||||
<p>Notes made during the implementation of ctype can be found
|
||||
<a href="ctype.html">here</a>.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="4">class messages</a></h2>
|
||||
<p> Notes made during the implementation of messages can be found
|
||||
<a href="messages.html">here</a>.
|
||||
<p>Notes made during the implementation of messages can be found
|
||||
<a href="messages.html">here</a>.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
@ -87,24 +88,24 @@
|
|||
description of locales and how to use them.
|
||||
</p>
|
||||
<p>He also writes:
|
||||
<BLOCKQUOTE><em>
|
||||
<blockquote><em>
|
||||
Please note that I still consider this detailed description of
|
||||
locales beyond the needs of most C++ programmers. It is written
|
||||
locales beyond the needs of most C++ programmers. It is written
|
||||
with experienced programmers in mind and novices will do best to
|
||||
avoid it.
|
||||
</em></BLOCKQUOTE>
|
||||
</em></blockquote>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="6">Nathan Myers on Locales</a></h2>
|
||||
<p> An article entitled "The Standard C++ Locale" was
|
||||
published in Dr. Dobb's Journal and can be found
|
||||
<p>An article entitled "The Standard C++ Locale" was
|
||||
published in Dr. Dobb's Journal and can be found
|
||||
<a href="http://www.cantrip.org/locale.html">here</a>.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="7">Correct Transformations</a></h2>
|
||||
<!-- Jumping directly here from chapter 21. -->
|
||||
<!-- Jumping directly to here from chapter 21. -->
|
||||
<p>A very common question on newsgroups and mailing lists is, "How
|
||||
do I do <foo> to a character string?" where <foo> is
|
||||
a task such as changing all the letters to uppercase, to lowercase,
|
||||
|
@ -130,7 +131,7 @@
|
|||
is created. Then member functions of that locale are called to
|
||||
perform minor tasks. Continuing the example from Chapter 21, we wish
|
||||
to use the following convenience functions:
|
||||
<PRE>
|
||||
<pre>
|
||||
namespace std {
|
||||
template <class charT>
|
||||
charT
|
||||
|
@ -138,7 +139,7 @@
|
|||
template <class charT>
|
||||
charT
|
||||
tolower (charT c, const locale& loc) const;
|
||||
}</PRE>
|
||||
}</pre>
|
||||
This function extracts the appropriate "facet" from the
|
||||
locale <em>loc</em> and calls the appropriate member function of that
|
||||
facet, passing <em>c</em> as its argument. The resulting character
|
||||
|
@ -153,7 +154,7 @@
|
|||
parameter. So we write simple wrapper structs to handle that.
|
||||
</p>
|
||||
<p>The next-to-final version of the code started in Chapter 21 looks like:
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <iterator> // for back_inserter
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
@ -198,7 +199,7 @@
|
|||
std::transform (s.begin(), s.end(), std::back_inserter(capital_s),
|
||||
up
|
||||
);
|
||||
}</PRE>
|
||||
}</pre>
|
||||
</p>
|
||||
<p>The final version of the code uses <code>bind2nd</code> to eliminate
|
||||
the wrapper structs, but the resulting code is tricky. I have not
|
||||
|
@ -210,10 +211,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 23.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 23.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 23</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 23: Containers</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 23: Containers</a></h1>
|
||||
|
||||
<p>Chapter 23 deals with container classes and what they offer.
|
||||
</p>
|
||||
|
@ -63,8 +63,8 @@
|
|||
code size or execution time.
|
||||
</p>
|
||||
<p>The result is that if all your algorithm calls look like
|
||||
<PRE>
|
||||
std::transform(beginof(foo), endof(foo), beginof(foo), SomeFunction);</PRE>
|
||||
<pre>
|
||||
std::transform(beginof(foo), endof(foo), beginof(foo), SomeFunction);</pre>
|
||||
then the type of foo can change from an array of ints to a vector
|
||||
of ints to a deque of ints and back again, without ever changing any
|
||||
client code.
|
||||
|
@ -84,8 +84,8 @@
|
|||
give the extra three lines and avoid confusion.
|
||||
</p>
|
||||
<p>Second, the line
|
||||
<PRE>
|
||||
inline unsigned int lengthof (T (&)[sz]) { return sz; } </PRE>
|
||||
<pre>
|
||||
inline unsigned int lengthof (T (&)[sz]) { return sz; } </pre>
|
||||
looks just weird! Hint: unused parameters can be left nameless.
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
|
@ -96,14 +96,14 @@
|
|||
<h2><a name="2">Variable-sized bitmasks</a></h2>
|
||||
<p>No, you cannot write code of the form
|
||||
<!-- Careful, the leading spaces in PRE show up directly. -->
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <bitset>
|
||||
|
||||
void foo (size_t n)
|
||||
{
|
||||
std::bitset<n> bits;
|
||||
....
|
||||
} </PRE>
|
||||
} </pre>
|
||||
because <code>n</code> must be known at compile time. Your compiler is
|
||||
correct; it is not a bug. That's the way templates work. (Yes, it
|
||||
<em>is</em> a feature.)
|
||||
|
@ -117,7 +117,8 @@
|
|||
<li>Extremely weird solutions.
|
||||
</ul>
|
||||
</p>
|
||||
<p><B>A very large N in <code>bitset<N></code>. </B> It has
|
||||
<p><strong>A very large N in
|
||||
<code>bitset<N></code>. </strong> It has
|
||||
been pointed out a few times in newsgroups that N bits only takes up
|
||||
(N/8) bytes on most systems, and division by a factor of eight is pretty
|
||||
impressive when speaking of memory. Half a megabyte given over to a
|
||||
|
@ -136,7 +137,8 @@
|
|||
there may be zero space overhead, but it's all allocated inside the
|
||||
object.)
|
||||
</p>
|
||||
<p><B>A container<bool>. </B> The Committee made provision
|
||||
<p><strong>A container<bool>. </strong> The Committee
|
||||
made provision
|
||||
for the space savings possible with that (N/8) usage previously mentioned,
|
||||
so that you don't have to do wasteful things like
|
||||
<code>Container<char></code> or
|
||||
|
@ -148,14 +150,15 @@
|
|||
normal vector anymore. There have been recent journal articles which
|
||||
discuss the problems (the ones by Herb Sutter in the May and
|
||||
July/August 1999 issues of
|
||||
<em>C++ Report</em> cover it well). Future revisions of the ISO C++
|
||||
<u>C++ Report</u> cover it well). Future revisions of the ISO C++
|
||||
Standard will change the requirement for <code>vector<bool></code>
|
||||
specialization. In the meantime, <code>deque<bool></code> is
|
||||
recommended (although its behavior is sane, you probably will not get
|
||||
the space savings, but the allocation scheme is different than that
|
||||
of vector).
|
||||
</p>
|
||||
<p><B>Extremely weird solutions. </B> If you have access to
|
||||
<p><strong>Extremely weird solutions. </strong> If you have
|
||||
access to
|
||||
the compiler and linker at runtime, you can do something insane, like
|
||||
figuring out just how many bits you need, then writing a temporary
|
||||
source code file. That file contains an instantiation of
|
||||
|
@ -260,8 +263,8 @@
|
|||
<h2><a name="4">"Hinting" during insertion</a></h2>
|
||||
<p>Section [23.1.2], Table 69, of the C++ standard lists this function
|
||||
for all of the associative containers (map, set, etc):
|
||||
<PRE>
|
||||
a.insert(p,t);</PRE>
|
||||
<pre>
|
||||
a.insert(p,t);</pre>
|
||||
where 'p' is an iterator into the container 'a', and 't' is the item
|
||||
to insert. The standard says that "iterator p is a hint
|
||||
pointing to where the insert should start to search," but
|
||||
|
@ -349,13 +352,13 @@
|
|||
</p>
|
||||
<p>For now you can simply make a temporary string object using the
|
||||
constructor expression:
|
||||
<PRE>
|
||||
<pre>
|
||||
std::bitset<5> b ( std::string("10110") );
|
||||
</PRE>
|
||||
</pre>
|
||||
instead of
|
||||
<PRE>
|
||||
<pre>
|
||||
std::bitset<5> b ( "10110" ); // invalid
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
<a href="../faq/index.html">to the FAQ</a>.
|
||||
|
@ -365,10 +368,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 24.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 24.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 24</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 24: Iterators</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 24: Iterators</a></h1>
|
||||
|
||||
<p>Chapter 24 deals with the FORTRAN subroutines for automatically
|
||||
transforming lemmings into gold.
|
||||
|
@ -50,7 +50,7 @@
|
|||
of overhead. (If you think that's the case anywhere, you don't
|
||||
understand templates to begin with...) Oh, no; if you pass
|
||||
in a pointer, then the compiler will instantiate that template
|
||||
using T* as a type and good old high-speed pointer arithmetic as
|
||||
using T* as a type, and good old high-speed pointer arithmetic as
|
||||
its operations, so the resulting code will be doing exactly the same
|
||||
things as it would be doing if you had hand-coded it yourself (for
|
||||
the 273rd time).
|
||||
|
@ -101,7 +101,7 @@
|
|||
<p>So, when you think of two pointers delimiting an array, don't think
|
||||
of them as indexing 0 through n-1. Think of them as <em>boundary
|
||||
markers</em>:
|
||||
<PRE>
|
||||
<pre>
|
||||
|
||||
beginning end
|
||||
| |
|
||||
|
@ -121,7 +121,7 @@
|
|||
| | dereference 'end'.
|
||||
beginning end
|
||||
|
||||
</PRE>
|
||||
</pre>
|
||||
See? Everything between the boundary markers is part of the array.
|
||||
Simple.
|
||||
</p>
|
||||
|
@ -172,10 +172,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 25.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 25.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 25</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 25: Algorithms</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 25: Algorithms</a></h1>
|
||||
|
||||
<p>Chapter 25 deals with the generalized subroutines for automatically
|
||||
transforming lemmings into gold.
|
||||
|
@ -49,9 +49,9 @@
|
|||
example, <code>string::find()</code>). Most of the examples on this
|
||||
page will use simple arrays of integers as a playground for
|
||||
algorithms, just to keep things simple.
|
||||
<a name="Nsize">The use of <B>N</B></a> as a size in the examples is
|
||||
to keep things easy to read but probably won't be legal code. You can
|
||||
use wrappers such as those described in the
|
||||
<a name="Nsize">The use of <strong>N</strong></a> as a size in the
|
||||
examples is to keep things easy to read but probably won't be valid
|
||||
code. You can use wrappers such as those described in the
|
||||
<a href="../23_containers/howto.html">containers chapter</a> to keep
|
||||
real code readable.
|
||||
</p>
|
||||
|
@ -63,8 +63,6 @@
|
|||
cause so much confusion. Once you get <em>range</em> into your head
|
||||
(it's not that hard, honest!), then the algorithms are a cakewalk.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>Return <a href="#top">to top of page</a> or
|
||||
<a href="../faq/index.html">to the FAQ</a>.
|
||||
</p>
|
||||
|
@ -93,10 +91,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 26.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 26.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 26</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 26: Numerics</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 26: Numerics</a></h1>
|
||||
|
||||
<p>Chapter 26 deals with building block abstractions to aid in
|
||||
numerical computing:
|
||||
<ul>
|
||||
<li>Template data structures such as <code>valarray<></code>
|
||||
and <code>complex<></code>.
|
||||
<li>Template numerical functions such as <code>accumulate</code>;
|
||||
<code>inner_product</code>; <code>partial_sum</code> and
|
||||
<li>Template numerical functions such as <code>accumulate</code>,
|
||||
<code>inner_product</code>, <code>partial_sum</code>, and
|
||||
<code>adjacent_difference</code>.
|
||||
</ul>
|
||||
All of the Standard C math functions are of course included in C++,
|
||||
|
@ -48,7 +48,7 @@
|
|||
compiled a list of C++98 and C99 conflict points; his description of
|
||||
C's new type versus those of C++ and how to get them playing together
|
||||
nicely is
|
||||
<a href="http://home.flash.net/~dtribble/text/cdiffs.htm#C99.complex">here</a>.
|
||||
<a href="http://david.tribble.com/text/cdiffs.htm#C99-complex">here</a>.
|
||||
</p>
|
||||
<p><code>complex<></code> is intended to be instantiated with a
|
||||
floating-point type. As long as you meet that and some other basic
|
||||
|
@ -66,9 +66,9 @@
|
|||
<h2><a name="2">Array Processing</a></h2>
|
||||
<p>One of the major reasons why FORTRAN can chew through numbers so well
|
||||
is that it is defined to be free of pointer aliasing, an assumption
|
||||
that C89 is not allowed to make, and neither is C++. C99 adds a new
|
||||
keyword, <code>restrict</code>, to apply to individual pointers. The C++
|
||||
solution is contained in the library rather than the language
|
||||
that C89 is not allowed to make, and neither is C++98. C99 adds a new
|
||||
keyword, <code>restrict</code>, to apply to individual pointers. The
|
||||
C++ solution is contained in the library rather than the language
|
||||
(although many vendors can be expected to add this to their compilers
|
||||
as an extension).
|
||||
</p>
|
||||
|
@ -102,7 +102,7 @@
|
|||
</ul>
|
||||
</p>
|
||||
<p>Here is a simple example of the two forms of <code>accumulate</code>.
|
||||
<PRE>
|
||||
<pre>
|
||||
int ar[50];
|
||||
int someval = somefunction();
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
|||
int sum = std::accumulate(ar,ar+50,0);
|
||||
int sum_stuff = std::accumulate(ar,ar+50,someval);
|
||||
int product = std::accumulate(ar,ar+50,1,std::multiplies<int>());
|
||||
</PRE>
|
||||
</pre>
|
||||
The first call adds all the members of the array, using zero as an
|
||||
initial value for <code>sum</code>. The second does the same, but uses
|
||||
<code>someval</code> as the starting value (thus, <code>sum_stuff == sum +
|
||||
|
@ -136,7 +136,8 @@
|
|||
neccessary support for C99 (e.g., header files) cannot be found.
|
||||
</p>
|
||||
<p>As of GCC 3.0, C99 support includes classification functions
|
||||
such as <code>isnormal</code>, <code>isgreater</code>, <code>isnan</code>, etc.
|
||||
such as <code>isnormal</code>, <code>isgreater</code>,
|
||||
<code>isnan</code>, etc.
|
||||
The functions used for 'long long' support such as <code>strtoll</code>
|
||||
are supported, as is the <code>lldiv_t</code> typedef. Also supported
|
||||
are the wide character functions using 'long long', like
|
||||
|
@ -151,10 +152,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<!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@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="HOWTO for the libstdc++ chapter 27.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="HOWTO, libstdc++, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="HOWTO for the libstdc++ chapter 27.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 HOWTO: Chapter 27</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Chapter 27: Input/Output</a></h1>
|
||||
<h1 class="centered"><a name="top">Chapter 27: Input/Output</a></h1>
|
||||
|
||||
<p>Chapter 27 deals with iostreams and all their subcomponents
|
||||
and extensions. All <em>kinds</em> of fun stuff.
|
||||
|
@ -39,21 +39,21 @@
|
|||
<p>So you want to copy a file quickly and easily, and most important,
|
||||
completely portably. And since this is C++, you have an open
|
||||
ifstream (call it IN) and an open ofstream (call it OUT):
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <fstream>
|
||||
|
||||
std::ifstream IN ("input_file");
|
||||
std::ofstream OUT ("output_file"); </PRE>
|
||||
std::ofstream OUT ("output_file"); </pre>
|
||||
</p>
|
||||
<p>Here's the easiest way to get it completely wrong:
|
||||
<PRE>
|
||||
OUT << IN;</PRE>
|
||||
<pre>
|
||||
OUT << IN;</pre>
|
||||
For those of you who don't already know why this doesn't work
|
||||
(probably from having done it before), I invite you to quickly
|
||||
create a simple text file called "input_file" containing
|
||||
the sentence
|
||||
<PRE>
|
||||
The quick brown fox jumped over the lazy dog.</PRE>
|
||||
<pre>
|
||||
The quick brown fox jumped over the lazy dog.</pre>
|
||||
surrounded by blank lines. Code it up and try it. The contents
|
||||
of "output_file" may surprise you.
|
||||
</p>
|
||||
|
@ -75,8 +75,8 @@
|
|||
as well as the streams themselves. The pointer is easily retrieved
|
||||
using the <code>rdbuf()</code> member function. Therefore, the easiest
|
||||
way to copy the file is:
|
||||
<PRE>
|
||||
OUT << IN.rdbuf();</PRE>
|
||||
<pre>
|
||||
OUT << IN.rdbuf();</pre>
|
||||
</p>
|
||||
<p>So what <em>was</em> happening with OUT<<IN? Undefined
|
||||
behavior, since that particular << isn't defined by the Standard.
|
||||
|
@ -121,17 +121,17 @@
|
|||
is the effect you want when writing to a screen -- get the text
|
||||
out as soon as possible, etc -- but the buffering is largely
|
||||
wasted when doing this to a file:
|
||||
<PRE>
|
||||
<pre>
|
||||
output << "a line of text" << endl;
|
||||
output << some_data_variable << endl;
|
||||
output << "another line of text" << endl; </PRE>
|
||||
output << "another line of text" << endl; </pre>
|
||||
The proper thing to do in this case to just write the data out
|
||||
and let the libraries and the system worry about the buffering.
|
||||
If you need a newline, just write a newline:
|
||||
<PRE>
|
||||
<pre>
|
||||
output << "a line of text\n"
|
||||
<< some_data_variable << '\n'
|
||||
<< "another line of text\n"; </PRE>
|
||||
<< "another line of text\n"; </pre>
|
||||
I have also joined the output statements into a single statement.
|
||||
You could make the code prettier by moving the single newline to
|
||||
the start of the quoted text on the thing line, for example.
|
||||
|
@ -139,9 +139,9 @@
|
|||
<p>If you do need to flush the buffer above, you can send an
|
||||
<code>endl</code> if you also need a newline, or just flush the buffer
|
||||
yourself:
|
||||
<PRE>
|
||||
<pre>
|
||||
output << ...... << flush; // can use std::flush manipulator
|
||||
output.flush(); // or call a member fn </PRE>
|
||||
output.flush(); // or call a member fn </pre>
|
||||
</p>
|
||||
<p>On the other hand, there are times when writing to a file should
|
||||
be like writing to standard error; no buffering should be done
|
||||
|
@ -149,7 +149,7 @@
|
|||
log file for security-related information). The way to do this is
|
||||
just to turn off the buffering <em>before any I/O operations at
|
||||
all</em> have been done, i.e., as soon as possible after opening:
|
||||
<PRE>
|
||||
<pre>
|
||||
std::ofstream os ("/foo/bar/baz");
|
||||
std::ifstream is ("/qux/quux/quuux");
|
||||
int i;
|
||||
|
@ -158,7 +158,7 @@
|
|||
is.rdbuf()->pubsetbuf(0,0);
|
||||
...
|
||||
os << "this data is written immediately\n";
|
||||
is >> i; // and this will probably cause a disk read </PRE>
|
||||
is >> i; // and this will probably cause a disk read </pre>
|
||||
</p>
|
||||
<p>Since all aspects of buffering are handled by a streambuf-derived
|
||||
member, it is necessary to get at that member with <code>rdbuf()</code>.
|
||||
|
@ -334,7 +334,7 @@
|
|||
transforms everything sent through it to uppercase. This version
|
||||
assumes many things about the nature of the character type being
|
||||
used (for more information, read the books or the newsgroups):
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <iostream>
|
||||
#include <streambuf>
|
||||
#include <locale>
|
||||
|
@ -365,13 +365,13 @@
|
|||
// create special output buffer
|
||||
outbuf ob;
|
||||
// initialize output stream with that output buffer
|
||||
std::ostream out(&ob);
|
||||
std::ostream out(&ob);
|
||||
|
||||
out << "31 hexadecimal: "
|
||||
<< std::hex << 31 << std::endl;
|
||||
return 0;
|
||||
}
|
||||
</PRE>
|
||||
</pre>
|
||||
Try it yourself!
|
||||
</p>
|
||||
|
||||
|
@ -407,14 +407,14 @@
|
|||
</p>
|
||||
<p>Because the C++ library includes the C library, both C-style and
|
||||
C++-style I/O have to work at the same time. For example:
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
std::cout << "Hel";
|
||||
std::printf ("lo, worl");
|
||||
std::cout << "d!\n";
|
||||
</PRE>
|
||||
</pre>
|
||||
This must do what you think it does.
|
||||
</p>
|
||||
<p>Alert members of the audience will immediately notice that buffering
|
||||
|
@ -434,11 +434,11 @@
|
|||
when both libraries' facilities are in use. If your program only uses
|
||||
C++ I/O, then there's no need to sync with the C streams. The right
|
||||
thing to do in this case is to call
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <em>any of the I/O headers such as ios, iostream, etc</em>
|
||||
|
||||
std::ios::sync_with_stdio(false);
|
||||
</PRE>
|
||||
</pre>
|
||||
</p>
|
||||
<p>You must do this before performing any I/O via the C++ stream objects.
|
||||
Once you call this, the C++ streams will operate independantly of the
|
||||
|
@ -446,9 +446,10 @@
|
|||
company will become fully buffered on their own.
|
||||
</p>
|
||||
<p>Note, by the way, that the synchronization requirement only applies to
|
||||
the standard streams (<code>cin</code>, <code>cout</code>, <code>cerr</code>,
|
||||
the standard streams (<code>cin</code>, <code>cout</code>,
|
||||
<code>cerr</code>,
|
||||
<code>clog</code>, and their wide-character counterparts). File stream
|
||||
objects that you create yourself have no such requirement and are fully
|
||||
objects that you declare yourself have no such requirement and are fully
|
||||
buffered.
|
||||
</p>
|
||||
|
||||
|
@ -456,10 +457,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr><br><br><br><br><br><br><br><br>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta NAME="AUTHOR" CONTENT="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta NAME="DESCRIPTION" CONTENT="Configuration options for libstdc++-v3.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta name="DESCRIPTION" content="Configuration options for libstdc++-v3.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 configure options</title>
|
||||
<link REL=StyleSheet HREF="lib3styles.css">
|
||||
<link rel=StyleSheet href="lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Interesting <code>configure</code>
|
||||
<h1 class="centered"><a name="top">Interesting <code>configure</code>
|
||||
options</a></h1>
|
||||
|
||||
<p>The latest version of this document is always available at
|
||||
|
@ -89,7 +89,7 @@ options</a></h1>
|
|||
(IEEE Std. 1003.1-200x) model based on langinfo/iconv/catgets,
|
||||
'gnu' to specify a model based on functionality from the GNU C
|
||||
library (langinfo/iconv/gettext) (from <A
|
||||
HREF="http://sources.redhat.com/glibc/">glibc</a>, the GNU C
|
||||
href="http://sources.redhat.com/glibc/">glibc</a>, the GNU C
|
||||
library), or 'generic' to use a generic "C"
|
||||
abstraction which consists of "C" locale info. The
|
||||
default is 'generic'.
|
||||
|
@ -167,16 +167,16 @@ options</a></h1>
|
|||
the following puts all the libstdc++ headers into a directory
|
||||
called "2.97-20001008" instead of the usual
|
||||
"g++-v3".
|
||||
<PRE>
|
||||
--with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008</PRE>
|
||||
<pre>
|
||||
--with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008</pre>
|
||||
</p>
|
||||
|
||||
<dt><code>--enable-cxx-flags=FLAGS</code>
|
||||
<dd><p>With this option, you can pass a string of -f (functionality)
|
||||
flags to the compiler to use when building libstdc++. FLAGS
|
||||
is a quoted string of options, like
|
||||
<PRE>
|
||||
--enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</PRE>
|
||||
<pre>
|
||||
--enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</pre>
|
||||
Note that the flags don't necessarily have to all be -f flags,
|
||||
as shown, but usually those are the ones that will make sense
|
||||
for experimentation and configure-time overriding.
|
||||
|
@ -187,13 +187,13 @@ options</a></h1>
|
|||
as well, so that everything matches.
|
||||
</p>
|
||||
<p>Fun flags to try might include combinations of
|
||||
<PRE>
|
||||
<pre>
|
||||
-fstrict-aliasing
|
||||
-fno-exceptions
|
||||
-ffunction-sections
|
||||
-fvtable-gc</PRE>
|
||||
and opposite forms (-fno-) of the same. Tell us (the mailing
|
||||
list) if you discover more!
|
||||
-fvtable-gc</pre>
|
||||
and opposite forms (-fno-) of the same. Tell us (the libstdc++
|
||||
mailing list) if you discover more!
|
||||
</p>
|
||||
|
||||
<dt><code>--enable-c-mbchar </code>[default]
|
||||
|
@ -207,17 +207,17 @@ options</a></h1>
|
|||
</dl>
|
||||
</p>
|
||||
<p>Return <a href="#top">to the top of the page</a> or
|
||||
<a href="http://gcc.gnu.org/libstdc++/">to the homepage</a>.
|
||||
<a href="http://gcc.gnu.org/libstdc++/">to the libstdc++ homepage</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, homepage, home, g++, libg++, STL">
|
||||
<meta name="KEYWORDS" content="libstdc++, homepage, home, g++, libg++, STL">
|
||||
<title>Standard C++ Library v3</title>
|
||||
<link REL=StyleSheet HREF="lib3styles.css">
|
||||
<link rel=StyleSheet href="lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -96,13 +96,13 @@
|
|||
|
||||
<!-- ####################################################### -->
|
||||
|
||||
<p>Return <a href="http://gcc.gnu.org/libstdc++/">to the homepage</a>.</p>
|
||||
<p>Return <a href="http://gcc.gnu.org/libstdc++/">to the libstdc++ homepage</a>.</p>
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta NAME="AUTHOR" CONTENT="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta NAME="DESCRIPTION" CONTENT="Explanatory notes about libstdc++-v3.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta name="DESCRIPTION" content="Explanatory notes about libstdc++-v3.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>Explanatory notes about libstdc++-v3 design</title>
|
||||
<link REL=StyleSheet HREF="lib3styles.css">
|
||||
<link rel=StyleSheet href="lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Explanatory notes about libstdc++-v3
|
||||
<h1 class="centered"><a name="top">Explanatory notes about libstdc++-v3
|
||||
design</a></h1>
|
||||
|
||||
<p>The latest version of this document is always available at
|
||||
|
@ -64,10 +64,10 @@ design</a></h1>
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<!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@gcc.gnu.org (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">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (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">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">Extensions</a></h1>
|
||||
<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:
|
||||
<p><strong>Before you leap in and use these</strong>, 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
|
||||
|
@ -48,14 +48,14 @@
|
|||
|
||||
<h2><a name="1">Ropes and trees and hashes, oh my!</a></h2>
|
||||
<p>The SGI headers
|
||||
<PRE>
|
||||
<pre>
|
||||
<bvector>
|
||||
<hash_map>
|
||||
<hash_set>
|
||||
<rope>
|
||||
<slist>
|
||||
<tree>
|
||||
</PRE> are all here; <code><bvector></code> exposes the old bit_vector
|
||||
</pre> are all here; <code><bvector></code> exposes the old bit_vector
|
||||
class that was used before specialization of vector<bool> was
|
||||
available (it's actually a typedef for the specialization now).
|
||||
<code><hash_map></code> and <code><hash_set></code>
|
||||
|
@ -87,17 +87,17 @@
|
|||
</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
|
||||
<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>
|
||||
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
|
||||
<p>(Side note: for those of you wondering, <strong>"Why wasn't a hash
|
||||
table included in the Standard in the first #!$@ place?"</strong>
|
||||
I'll give a quick answer: it was proposed, but too late and in too
|
||||
unorganized a fashion. Some sort of hashing will undoubtedly be
|
||||
included in a future Standard.
|
||||
</p>
|
||||
|
@ -309,10 +309,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta NAME="AUTHOR" CONTENT="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++, STL, SGI">
|
||||
<meta NAME="DESCRIPTION" CONTENT="SGI extensions preserved in libstdc++-v3.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++, STL, SGI">
|
||||
<meta name="DESCRIPTION" content="SGI extensions preserved in libstdc++-v3.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>SGI extensions to the library in libstdc++-v3</title>
|
||||
<link REL=StyleSheet HREF="lib3styles.css">
|
||||
<link rel=StyleSheet href="lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">SGI extensions to the library in
|
||||
<h1 class="centered"><a name="top">SGI extensions to the library in
|
||||
libstdc++-v3</a></h1>
|
||||
|
||||
<p>This page describes the extensions that SGI made to their version of the
|
||||
|
@ -25,7 +25,7 @@ libstdc++-v3</a></h1>
|
|||
for a description). Not every chapter may have extensions, and the
|
||||
extensions may come and go. Also, this page is incomplete because the
|
||||
author is pressed for time. Check back often; the latest change was on
|
||||
$Date: 2001/09/27 00:48:00 $ (UTC).
|
||||
$Date: 2001/10/04 20:03:22 $ (UTC).
|
||||
</p>
|
||||
|
||||
<p>Descriptions range from the scanty to the verbose. You should also check
|
||||
|
@ -223,10 +223,10 @@ libstdc++-v3</a></h1>
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++, libg++, STL">
|
||||
<meta NAME="DESCRIPTION" CONTENT="FAQ for the GNU libstdc++ effort.">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++, libg++, STL">
|
||||
<meta name="DESCRIPTION" content="FAQ for the GNU libstdc++ effort.">
|
||||
<title>libstdc++-v3 FAQ</title>
|
||||
<link REL=StyleSheet HREF="../lib3styles.css">
|
||||
<link rel=StyleSheet href="../lib3styles.css">
|
||||
<!--
|
||||
** Locations of "the most recent snapshot is the Nth" text are
|
||||
** answers 1_1, 1_4, 4_1, 5_6.
|
||||
|
@ -12,7 +12,7 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered">libstdc++ Frequently Asked Questions</h1>
|
||||
<h1 class="centered">libstdc++ Frequently Asked Questions</h1>
|
||||
|
||||
<p>The latest version of this document is always available at
|
||||
<a href="http://gcc.gnu.org/onlinedocs/libstdc++/faq/">
|
||||
|
@ -100,8 +100,8 @@ http://gcc.gnu.org/onlinedocs/libstdc++/faq/</a>.</p>
|
|||
ongoing project to implement the ISO 14882 Standard C++ library
|
||||
as described in chapters 17 through 27 and annex D. As the
|
||||
library reaches stable plateaus, it is captured in a snapshot
|
||||
and released. The current release is <A
|
||||
HREF="ftp://gcc.gnu.org/pub/libstdc++/libstdc++-2.92.tar.gz">the
|
||||
and released. The current release is
|
||||
<a href="http://gcc.gnu.org/libstdc++/download.html">the
|
||||
eleventh snapshot</a>. For those who want to see exactly how
|
||||
far the project has come, or just want the latest
|
||||
bleeding-edge code, the up-to-date source is available over
|
||||
|
@ -126,8 +126,7 @@ HREF="ftp://gcc.gnu.org/pub/libstdc++/libstdc++-2.92.tar.gz">the
|
|||
has recently been taken over by the
|
||||
<a href="http://gcc.gnu.org/">GCC team</a>. All of
|
||||
the rapid development and near-legendary
|
||||
<A
|
||||
HREF="http://gcc.gnu.org/gcc-2.95/buildstat.html">portability</a>
|
||||
<a href="http://gcc.gnu.org/gcc-2.95/buildstat.html">portability</a>
|
||||
that are the hallmarks of an open-source project are being
|
||||
applied to libstdc++.
|
||||
</p>
|
||||
|
@ -154,31 +153,29 @@ HREF="http://gcc.gnu.org/gcc-2.95/buildstat.html">portability</a>
|
|||
|
||||
<hr>
|
||||
<h2><a name="1_4">1.4 How do I get libstdc++?</a></h2>
|
||||
<p>The eleventh (and latest) snapshot of libstdc++-v3 is <A
|
||||
HREF="ftp://gcc.gnu.org/pub/libstdc++/libstdc++-2.92.tar.gz">
|
||||
available via ftp</a>.
|
||||
<p>The eleventh (and latest) snapshot of libstdc++-v3 is
|
||||
<a href="http://gcc.gnu.org/libstdc++/download.html">available via
|
||||
ftp</a>. The filename is libstdc++-2.92.tar.gz.
|
||||
</p>
|
||||
<p>The <a href="http://gcc.gnu.org/libstdc++/">homepage</a>
|
||||
has instructions for retrieving the latest CVS sources, and for
|
||||
browsing the CVS sources over the web.
|
||||
</p>
|
||||
<p>The subset commonly known as the Standard Template Library
|
||||
(chapters 23 through 25, mostly) is adapted from the SGI STL,
|
||||
which is also an ongoing work.<!-- Possibly a link to SGI's
|
||||
STL here. -->
|
||||
(chapters 23 through 25, mostly) is adapted from the final release
|
||||
of the SGI STL.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<h2><a name="1_5">1.5 When is libstdc++ going to be finished?</a></h2>
|
||||
<!-- <p>Nathan Myers gave the best of all possible answers in <A
|
||||
HREF="http://www.deja.com/getdoc.xp?AN=469581698&fmt=text">a
|
||||
href="http://www.deja.com/getdoc.xp?AN=469581698&fmt=text">a
|
||||
Usenet article</a>.</p>
|
||||
which is no longer available, thanks deja...-->
|
||||
<p>Nathan Myers gave the best of all possible answers, responding to a
|
||||
Usenet article asking this question: <em>Sooner, if you help.</em>
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h2><a name="1_6">1.6 How do I contribute to the effort?</a></h2>
|
||||
<p>Here is <a href="../17_intro/contribute.html">a
|
||||
|
@ -238,7 +235,7 @@ which is no longer available, thanks deja...-->
|
|||
send a message to it. More information is available on the
|
||||
homepage (including how to browse the list archives); to send
|
||||
to the list, use <a href="mailto:libstdc++@gcc.gnu.org">
|
||||
<CODE>libstdc++@gcc.gnu.org</CODE></a>.
|
||||
<code>libstdc++@gcc.gnu.org</code></a>.
|
||||
</p>
|
||||
<p>If you have a question that you think should be included here,
|
||||
or if you have a question <em>about</em> a question/answer here,
|
||||
|
@ -293,7 +290,7 @@ which is no longer available, thanks deja...-->
|
|||
<p>The <em>Concurrent Versions System</em> is one of several revision
|
||||
control packages. It was selected for GNU projects because it's
|
||||
free (speech), free (beer), and very high quality. The <A
|
||||
HREF="http://www.gnu.org/software/cvs/cvs.html">CVS entry in
|
||||
href="http://www.gnu.org/software/cvs/cvs.html">CVS entry in
|
||||
the GNU software catalogue</a> has a better description as
|
||||
well as a
|
||||
<a href="http://www.cvshome.org/">link to the makers of CVS</a>.
|
||||
|
@ -318,9 +315,9 @@ which is no longer available, thanks deja...-->
|
|||
the testsuite on the library after building and installing it,
|
||||
use "make check-install" instead.
|
||||
</p>
|
||||
<p>If you find bugs in the testsuite programs themselves, or if
|
||||
you think of a new test program that should be added to the
|
||||
suite, <B>please</B> write up your idea and send it to the list!
|
||||
<p>If you find bugs in the testsuite programs themselves, or if you
|
||||
think of a new test program that should be added to the suite,
|
||||
<strong>please</strong> write up your idea and send it to the list!
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
@ -366,7 +363,6 @@ which is no longer available, thanks deja...-->
|
|||
these two pseudos would win praise and accolades from many.
|
||||
</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<h1><a name="4_0">4.0 Known Bugs and Non-Bugs</a></h1>
|
||||
<em>Note that this section can get rapdily outdated -- such is the
|
||||
|
@ -442,13 +438,13 @@ New:
|
|||
|
||||
<hr>
|
||||
<h2><a name="4_3">4.3 Bugs in the C++ language/lib specification</a></h2>
|
||||
<p>Yes, unfortunately, there are some. In a <A
|
||||
HREF="http://gcc.gnu.org/ml/libstdc++/1998/msg00006.html">message
|
||||
to the list</a>, Nathan Myers announced that he has started a list of
|
||||
<p>Yes, unfortunately, there are some. In a
|
||||
<a href="http://gcc.gnu.org/ml/libstdc++/1998/msg00006.html">message
|
||||
to the list</a>, Nathan Myers announced that he has started a list of
|
||||
problems in the ISO C++ Standard itself, especially with
|
||||
regard to the chapters that concern the library. The list
|
||||
itself is <A
|
||||
HREF="http://www.cantrip.org/draft-bugs.txt">posted on his
|
||||
itself is
|
||||
<a href="http://www.cantrip.org/draft-bugs.txt">posted on his
|
||||
website</a>. Developers who are having problems interpreting
|
||||
the Standard may wish to consult his notes.
|
||||
</p>
|
||||
|
@ -528,7 +524,7 @@ to the list</a>, Nathan Myers announced that he has started a list of
|
|||
mailing list.
|
||||
</p>
|
||||
<p>Currently our header files are installed in
|
||||
<CODE>${prefix}/include/g++-v3</CODE> (see the 'v'?). This may
|
||||
<code>${prefix}/include/g++-v3</code> (see the 'v'?). This may
|
||||
change with the next release of GCC, as it may be too confusing,
|
||||
but <a href="http://gcc.gnu.org/ml/gcc/2000-10/msg00732.html">the
|
||||
question has not yet been decided</a>.
|
||||
|
@ -539,14 +535,14 @@ to the list</a>, Nathan Myers announced that he has started a list of
|
|||
If you're on a GNU/Linux system and have just upgraded to
|
||||
glibc 2.2, but are still using gcc 2.95.2, then you should have
|
||||
read the glibc FAQ, specifically 2.34:
|
||||
<PRE>
|
||||
<pre>
|
||||
2.34. When compiling C++ programs, I get a compilation error in streambuf.h.
|
||||
|
||||
{BH} You are using g++ 2.95.2? After upgrading to glibc 2.2, you need to
|
||||
apply a patch to the include files in /usr/include/g++, because the fpos_t
|
||||
type has changed in glibc 2.2. The patch is at
|
||||
http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
|
||||
</PRE>
|
||||
</pre>
|
||||
Note that 2.95.x shipped with the
|
||||
<a href="#4_4_interface">old v2 library</a> which is no longer
|
||||
maintained. Also note that gcc 2.95.3 fixes this problem, but
|
||||
|
@ -645,11 +641,10 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
|
|||
instance) will of course be a continuing task.
|
||||
</p>
|
||||
</ol>
|
||||
<p><A
|
||||
HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00080.html">This
|
||||
<p><a href="http://gcc.gnu.org/ml/libstdc++/1999/msg00080.html">This
|
||||
question</a> about the next libstdc++ prompted some brief but
|
||||
interesting <A
|
||||
HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
|
||||
interesting
|
||||
<a href="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
@ -676,9 +671,9 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
|
|||
it is better to refer to files there by their path, as in:
|
||||
<!-- Careful, the leading spaces in PRE show up directly. -->
|
||||
</p>
|
||||
<PRE>
|
||||
<pre>
|
||||
#include <ext/hash_map>
|
||||
</PRE>
|
||||
</pre>
|
||||
<p>Extensions to the library have
|
||||
<a href="../ext/howto.html">their own page</a>.
|
||||
</p>
|
||||
|
@ -698,11 +693,11 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
|
|||
<p>This is assuming that your idea of "multithreaded"
|
||||
is the same as ours... The general question of multithreading
|
||||
and libstdc++-v3 is addressed in the chapter-specific advice for
|
||||
<a href="http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#3">Library
|
||||
Introduction</a>. Threadsafe containers are covered in
|
||||
more detail in
|
||||
<a href="http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html">the
|
||||
Received Wisdom section on containers</a>.
|
||||
<a href="../17_intro/howto.html#3">Library Introduction</a>.
|
||||
Threadsafe containers are covered in more detail in
|
||||
<a href="../23_containers/howto.html">the Received Wisdom section
|
||||
on containers</a>. Threading and I/O are discussed in
|
||||
<a href="../27_io/howto.html">the I/O chapter</a>.
|
||||
<!-- I have successfully evaded the topic; my work here is
|
||||
done- no, wait, I have to write those other sections... -->
|
||||
</p>
|
||||
|
@ -728,10 +723,10 @@ HREF="http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html">speculation</a>.
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="../17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
|
@ -105,14 +105,14 @@
|
|||
1.4 How do I get libstdc++?
|
||||
|
||||
The eleventh (and latest) snapshot of libstdc++-v3 is [47]available
|
||||
via ftp.
|
||||
via ftp. The filename is libstdc++-2.92.tar.gz.
|
||||
|
||||
The [48]homepage has instructions for retrieving the latest CVS
|
||||
sources, and for browsing the CVS sources over the web.
|
||||
|
||||
The subset commonly known as the Standard Template Library (chapters
|
||||
23 through 25, mostly) is adapted from the SGI STL, which is also an
|
||||
ongoing work.
|
||||
23 through 25, mostly) is adapted from the final release of the SGI
|
||||
STL.
|
||||
_________________________________________________________________
|
||||
|
||||
1.5 When is libstdc++ going to be finished?
|
||||
|
@ -555,7 +555,8 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
|
|||
ours... The general question of multithreading and libstdc++-v3 is
|
||||
addressed in the chapter-specific advice for [80]Library Introduction.
|
||||
Threadsafe containers are covered in more detail in [81]the Received
|
||||
Wisdom section on containers.
|
||||
Wisdom section on containers. Threading and I/O are discussed in
|
||||
[82]the I/O chapter.
|
||||
_________________________________________________________________
|
||||
|
||||
5.7 How do I get a copy of the ISO C++ Standard?
|
||||
|
@ -566,16 +567,16 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
|
|||
their two-meeting commitment for voting rights, may get a copy of the
|
||||
standard from their respective national standards organization. In the
|
||||
USA, this national standards organization is ANSI and their website is
|
||||
right [82]here. (And if you've already registered with them, clicking
|
||||
this link will take you to directly to the place where you can [83]buy
|
||||
right [83]here. (And if you've already registered with them, clicking
|
||||
this link will take you to directly to the place where you can [84]buy
|
||||
the standard on-line.
|
||||
|
||||
Who is your country's member body? Visit the [84]ISO homepage and find
|
||||
Who is your country's member body? Visit the [85]ISO homepage and find
|
||||
out!
|
||||
_________________________________________________________________
|
||||
|
||||
See [85]license.html for copying conditions. Comments and suggestions
|
||||
are welcome, and may be sent to [86]the mailing list.
|
||||
See [86]license.html for copying conditions. Comments and suggestions
|
||||
are welcome, and may be sent to [87]the libstdc++ mailing list.
|
||||
|
||||
References
|
||||
|
||||
|
@ -620,12 +621,12 @@ References
|
|||
39. ../faq/index.html#5_5
|
||||
40. ../faq/index.html#5_6
|
||||
41. ../faq/index.html#5_7
|
||||
42. ftp://gcc.gnu.org/pub/libstdc++/libstdc++-2.92.tar.gz
|
||||
42. http://gcc.gnu.org/libstdc++/download.html
|
||||
43. ../17_intro/DESIGN
|
||||
44. http://gcc.gnu.org/
|
||||
45. http://gcc.gnu.org/gcc-2.95/buildstat.html
|
||||
46. http://gcc.gnu.org/libstdc++/
|
||||
47. ftp://gcc.gnu.org/pub/libstdc++/libstdc++-2.92.tar.gz
|
||||
47. http://gcc.gnu.org/libstdc++/download.html
|
||||
48. http://gcc.gnu.org/libstdc++/
|
||||
49. ../17_intro/contribute.html
|
||||
50. http://www.boost.org/
|
||||
|
@ -658,10 +659,11 @@ References
|
|||
77. http://gcc.gnu.org/ml/libstdc++/1999/msg00084.html
|
||||
78. http://www.sgi.com/Technology/STL/
|
||||
79. ../ext/howto.html
|
||||
80. http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#3
|
||||
81. http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html
|
||||
82. http://www.ansi.org/
|
||||
83. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
|
||||
84. http://www.iso.ch/
|
||||
85. ../17_intro/license.html
|
||||
86. mailto:libstdc++@gcc.gnu.org
|
||||
80. ../17_intro/howto.html#3
|
||||
81. ../23_containers/howto.html
|
||||
82. ../27_io/howto.html
|
||||
83. http://www.ansi.org/
|
||||
84. http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+14882%2D1998
|
||||
85. http://www.iso.ch/
|
||||
86. ../17_intro/license.html
|
||||
87. mailto:libstdc++@gcc.gnu.org
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta NAME="AUTHOR" CONTENT="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta NAME="DESCRIPTION" CONTENT="README for the GNU libstdc++ effort.">
|
||||
<meta NAME="GENERATOR" CONTENT="vi and eight fingers">
|
||||
<meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)">
|
||||
<meta name="KEYWORDS" content="libstdc++, libstdc++-v3, GCC, g++">
|
||||
<meta name="DESCRIPTION" content="README for the GNU libstdc++ effort.">
|
||||
<meta name="GENERATOR" content="vi and eight fingers">
|
||||
<title>libstdc++-v3 Installation Instructions</title>
|
||||
<link REL=StyleSheet HREF="lib3styles.css">
|
||||
<link rel=StyleSheet href="lib3styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 CLASS="centered"><a name="top">libstdc++-v3 INSTALL</a></h1>
|
||||
<h1 class="centered"><a name="top">libstdc++-v3 INSTALL</a></h1>
|
||||
|
||||
<p>The latest version of this document is always available at
|
||||
<a href="http://gcc.gnu.org/onlinedocs/libstdc++/install.html">
|
||||
|
@ -124,20 +124,20 @@
|
|||
(<code>gcc</code> or <code>gcc-3.0</code>, for example) is <em>gccsrcdir</em>.
|
||||
Once in <em>gccsrcdir</em>, you'll need to rename or delete the
|
||||
libstdc++-v3 directory which comes with that snapshot:
|
||||
<PRE>
|
||||
<pre>
|
||||
mv libstdc++-v3 libstdc++-v3-previous <strong>[OR]</strong>
|
||||
rm -r libstdc++-v3</PRE>
|
||||
rm -r libstdc++-v3</pre>
|
||||
</p>
|
||||
<p>Next, unpack the libstdc++-v3 library tarball into this
|
||||
<em>gccsrcdir</em> directory; it will create a
|
||||
<em>libsrcdir</em> called <code>libstdc++-<em>version</em></code>:
|
||||
<PRE>
|
||||
gzip -dc libstdc++-version.tar.gz | tar xf -</PRE>
|
||||
<pre>
|
||||
gzip -dc libstdc++-version.tar.gz | tar xf -</pre>
|
||||
</p>
|
||||
<p>Finally, rename <em>libsrcdir</em> to <code>libstdc++-v3</code> so that
|
||||
gcc's configure flags will be able to deal with the new library.
|
||||
<PRE>
|
||||
mv <em>libsrcdir</em> libstdc++-v3</PRE>
|
||||
<pre>
|
||||
mv <em>libsrcdir</em> libstdc++-v3</pre>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -156,9 +156,9 @@
|
|||
building the C++ language parts.
|
||||
</p>
|
||||
|
||||
<p><PRE>
|
||||
<p><pre>
|
||||
cd <em>gccbuilddir</em>
|
||||
<em>gccsrcdir</em>/configure --prefix=<em>destdir</em> --other-opts...</PRE>
|
||||
<em>gccsrcdir</em>/configure --prefix=<em>destdir</em> --other-opts...</pre>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -178,8 +178,8 @@
|
|||
|
||||
<h3>[re]building only libstdc++</h3>
|
||||
<p>To rebuild just libstdc++, use:
|
||||
<PRE>
|
||||
make all-target-<em>libstdc++-v3</em></PRE>
|
||||
<pre>
|
||||
make all-target-<em>libstdc++-v3</em></pre>
|
||||
This will configure and build the C++ library in the
|
||||
<em>gccbuilddir/cpu-vendor-os/</em>libstdc++ directory.
|
||||
</p>
|
||||
|
@ -193,12 +193,12 @@
|
|||
simply edit it and remove lines.
|
||||
</p>
|
||||
<p>You're done. Now install the rebuilt pieces with
|
||||
<PRE>
|
||||
make install</PRE>
|
||||
<pre>
|
||||
make install</pre>
|
||||
or
|
||||
<PRE>
|
||||
<pre>
|
||||
make install-gcc
|
||||
make install-target-libstdc++-v3</PRE>
|
||||
make install-target-libstdc++-v3</pre>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -206,20 +206,20 @@
|
|||
<h2><a name="postinstall">Post-installation</a></h2>
|
||||
<p>Installation will create the <em>destdir</em> directory and
|
||||
populate it with subdirectories:
|
||||
<PRE>
|
||||
<pre>
|
||||
lib/
|
||||
include/g++-v3/
|
||||
backward/
|
||||
bits/
|
||||
<em>cpu-vendor-os</em>/bits/
|
||||
ext/</PRE>
|
||||
ext/</pre>
|
||||
</p>
|
||||
<p>You can check the status of the build without installing it using
|
||||
<PRE>
|
||||
make check</PRE>
|
||||
<pre>
|
||||
make check</pre>
|
||||
or you can check the status of the installed library using
|
||||
<PRE>
|
||||
make check-install</PRE>
|
||||
<pre>
|
||||
make check-install</pre>
|
||||
in the <em>libbuilddir</em> directory.
|
||||
These commands will create a 'testsuite' directory underneath
|
||||
<em>libbuilddir</em> containing the results of the tests. We are
|
||||
|
@ -280,10 +280,10 @@
|
|||
<!-- ####################################################### -->
|
||||
|
||||
<hr>
|
||||
<P CLASS="fineprint"><em>
|
||||
<p class="fineprint"><em>
|
||||
See <a href="17_intro/license.html">license.html</a> for copying conditions.
|
||||
Comments and suggestions are welcome, and may be sent to
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the mailing list</a>.
|
||||
<a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.
|
||||
</em></p>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue