From: Jonathan Wakely
The Standard C++ Library v3, or libstc++-2.90.x, follows an open development model. Active contributors are assigned maintainer-ship responsibility, and given write access to the CVS repository. First time submitors and all other potential contributors should follow this procedure:
+
-
-
-
Small changes can be accepted without a copyright assignment form on
@@ -56,40 +60,43 @@ to fill out appropriate disclaimer forms as well. Here is the Benjamin
Kosnik if you are confused about the assignment or have general
licensing questions.
+
-
+
Every patch must have several pieces of information before it can be
properly evaluated. Ideally (and to ensure the fastest possible
response from the maintainers) it would have all of these pieces:
-
+How to contribute
+
ONE : read the documentation
-
-
+
TWO : copyright assignment
+
THREE : submitting patches
-
+
+
diff --git a/libstdc++-v3/docs/html/17_intro/howto.html b/libstdc++-v3/docs/html/17_intro/howto.html
index 21f83f97e69..c3b82f56b33 100644
--- a/libstdc++-v3/docs/html/17_intro/howto.html
+++ b/libstdc++-v3/docs/html/17_intro/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
Contents
-
-<foo>
vs <foo.h>
- <foo>
vs <foo.h>
+
@@ -51,7 +50,7 @@
all compile and run.
This section discusses issues surrounding the proper compilation of multithreaded applications which use the Standard C++ @@ -129,16 +128,17 @@ relevant message in the thread; from there you can use "Thread Next" to move down the thread. This farm is in latest-to-oldest order. +
(A large selection of links to older messages has been removed; many of the messages from 1999 were lost in a disk crash, and the few people with access to the backup tapes have been too swamped with work to restore them. Many of the points have been superseded anyhow.) @@ -150,7 +150,7 @@ to the FAQ.
-<foo>
vs <foo.h>
The new-style headers are fully supported in libstdc++-v3. The compiler
itself fully supports namespaces, including std::
.
@@ -164,16 +164,18 @@
to the FAQ.
The ISO standard defines the following phrase: +
- We do so here, for the C++ library only. Behavior of the compiler, +-
[1.3.5] implementation-defined behavior
+[1.3.5] implementation-defined behavior
- behavior, for a well-formed program construct and correct data, that depends on the implementation and that each implementation shall document. +
We do so here, for the C++ library only. Behavior of the compiler, linker, runtime loader, and other elements of "the implementation" are documented elsewhere. Everything listed in Annex B, Implemenation Qualities, are also part of the compiler, not @@ -196,10 +198,10 @@ sections, libstdc++-v3 has zero control over what the cleanup code hands back to the runtime loader. Talk to the compiler people. :-)
-[18.4.2.1]/5 (bad_alloc),
- [18.5.2]/5 (bad_cast),
- [18.5.3]/5 (bad_typeid),
- [18.6.1]/8 (exception),
+
[18.4.2.1]/5 (bad_alloc),
+ [18.5.2]/5 (bad_cast),
+ [18.5.3]/5 (bad_typeid),
+ [18.6.1]/8 (exception),
[18.6.2.1]/5 (bad_exception): The what()
member function of class std::exception
, and these other
classes publicly derived from it, simply returns the name of the
@@ -225,10 +227,10 @@
have any allocators which compare non-equal, so we can't describe how
they behave.
[21.1.3.1]/3,4,
- [21.1.3.2]/2,
- [23.*]'s foo::iterator,
- [27.*]'s foo::*_type,
+
[21.1.3.1]/3,4,
+ [21.1.3.2]/2,
+ [23.*]'s foo::iterator,
+ [27.*]'s foo::*_type,
others...
Nope, these types are called implementation-defined because you
shouldn't be taking advantage of their underlying types. Listing them
@@ -257,7 +259,7 @@
than the minimum required. I don't think we're currently taking
advantage of this yet.
[27.7.1.3]/16,
+
[27.7.1.3]/16,
[27.8.1.4]/10
The effects of pubsetbuf/setbuf
are described
in this chapter.
@@ -269,7 +271,7 @@
to the FAQ.
Some of the semantics of the libstdc++-v3 implementation are controlled by preprocessor macros, both during build/installation and @@ -297,6 +299,7 @@ The default state of the symbol is listed. "Configurable" (or "Not configurable") means that the symbol is initially chosen (or not) based on --enable/--disable options at configure time. +
_GLIBCPP_DEPRECATED
Return to top of page or to the FAQ.
@@ -338,7 +340,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/17_intro/license.html b/libstdc++-v3/docs/html/17_intro/license.html
index c3449b1ff2f..7db8aa5f240 100644
--- a/libstdc++-v3/docs/html/17_intro/license.html
+++ b/libstdc++-v3/docs/html/17_intro/license.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+ +As a special exception, you may use this file as part of a free software library without restriction. Specifically, if other files instantiate templates or use macros or inline functions from this file, or you compile @@ -38,8 +38,7 @@ the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. -- +
Hopefully that text is self-explanatory. If it isn't, you need to speak to your lawyer, or the Free Software Foundation. @@ -50,14 +49,14 @@ http://gcc.gnu.org/ml/libstdc++/2000-q2/subjects.html#00050 -->
Q: So any program which uses libstdc++ falls under the GPL?
-
A: No. The special exception permits use of the
+
A: No. The special exception permits use of the
library in proprietary applications.
Q: How is that different from the GNU {Lesser,Library}
GPL?
-
A: The LGPL requires that users be able to replace the LGPL code with a
+
A: The LGPL requires that users be able to replace the LGPL code with a
modified version; this is trivial if the library in question is a C
shared library. But there's no way to make that work with C++, where
much of the library consists of inline functions and templates, which
@@ -68,11 +67,11 @@
Q: I see. So, what restrictions are there on
programs that use the library?
-
A: None. We encourage such programs to be released as open source,
+
A: None. We encourage such programs to be released as open source,
but we won't punish you or sue you if you choose otherwise.
Comments and suggestions about this page are welcome, and may be sent to
the libstdc++ mailing list.
diff --git a/libstdc++-v3/docs/html/18_support/howto.html b/libstdc++-v3/docs/html/18_support/howto.html
index 10c74a9cbff..c055f999bdc 100644
--- a/libstdc++-v3/docs/html/18_support/howto.html
+++ b/libstdc++-v3/docs/html/18_support/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
Contents
-
-
+
@@ -55,12 +54,13 @@
always a pointer.)
In his book - Effective C++, + Effective C++, Scott Meyers points out that the best way to solve this problem is to 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: -
+ ++const // this is a const object... class { public: @@ -77,7 +77,8 @@ // taken (see Item 27)... } NULL; // and whose name is NULL -(Cribbed from the published version of +
(Cribbed from the published version of the Effective C++ CD, reproduced here with permission.)
@@ -93,7 +94,7 @@ 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 - an + an article to Usenet after discovering that the code above is not valid! Even though it has no data members, it still needs a user-defined constructor (which means that the class needs a type name @@ -105,14 +106,14 @@ to the FAQ. -
<limits>
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 numeric_limits
defined as follows:
+
template<typename T> struct class { static const bool is_specialized; @@ -150,12 +151,11 @@ static const bool tinyness_before; static const float_round_style round_style; };-
Return to top of page or to the FAQ.
-Not many changes here to <cstdlib>
(the old stdlib.h).
You should note that the abort()
function does not call
@@ -166,11 +166,14 @@
The good old exit()
function can be a bit funky, too, until
you look closer. Basically, three points to remember are:
+
atexit()
are called in
reverse order of registration, once per registration call.
(This isn't actually new.)
+ @@ -181,12 +184,13 @@ atexit(f1); static Thing obj2; atexit(f2); -then at a call of
exit()
, f2 will be called, then
+
+ then at a call of exit()
, 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 propagate
out of them, Bad Things happen.
+ Note also that atexit()
is only required to store 32
functions, and the compiler/library might already be using some of
those slots. If you think you may run out, we recommend using
@@ -196,21 +200,22 @@
to the FAQ.
There are six flavors each of new
and delete
, so
make certain that you're using the right ones! Here are quickie
descriptions of new
:
-
bad_alloc
on errors;
- this is what most people are used to using
- bad_alloc
on errors
- bad_alloc
on errors;
+ this is what most people are used to usingbad_alloc
on errorsThey are distinguished by the parameters that you pass to them, like
any other overloaded function. The six flavors of delete
are distinguished the same way, but none of them are allowed to throw
an exception under any circumstances anyhow. (They match up for
@@ -225,7 +230,8 @@
bad_alloc
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 set_new_handler()
:
-
+ +typedef void (*PFV)(void); static char* safety; @@ -247,8 +253,7 @@ old_handler = set_new_handler (&my_new_handler); ... } -- +
bad_alloc
is derived from the base exception
class defined in Chapter 19.
If you have read the source
documentation for namespace abi
then you are aware
@@ -271,7 +276,8 @@
Probably the only times you'll be interested in demangling at runtime
are when you're seeing typeid
strings in RTTI, or when
you're handling the runtime-support exception classes. For example:
-
+ ++#include <exception> #include <iostream> #include <cxxabi.h> @@ -304,11 +310,12 @@ int main() free(realname); return 0; -}-With GCC 3.1 and later, this prints
- St13bad_exception => std::bad_exception : 0 - 3barI5emptyLi17EE => bar<empty, 17> : 0+}
With GCC 3.1 and later, this prints
++ St13bad_exception => std::bad_exception : 0 + 3barI5emptyLi17EE => bar<empty, 17> : 0
The demangler interface is described in the source documentation linked to above. It is actually written in C, so you don't need to be writing C++ in order to demangle C++. (That also means we have to @@ -322,7 +329,7 @@ int main() -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/19_diagnostics/howto.html b/libstdc++-v3/docs/html/19_diagnostics/howto.html
index 3d8bf6f8bbc..07585bb8347 100644
--- a/libstdc++-v3/docs/html/19_diagnostics/howto.html
+++ b/libstdc++-v3/docs/html/19_diagnostics/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
Contents
-
-terminate
+ terminate
+
@@ -56,7 +55,7 @@
to the FAQ.
At one point we were going to make up a PDF of the exceptions hierarchy, akin to the one done for the I/O class hierarchy. @@ -72,7 +71,7 @@ to the FAQ.
-Better taste! Less fat! Literally!
In 1999, SGI added concept checkers to their implementation @@ -89,7 +88,7 @@ were found in it on more than one occasion.
The primary author of the checking code, Jeremy Siek, had already - started work on a replcement implementation. The new code has been + started work on a replacement implementation. The new code has been formally reviewed and accepted into the Boost libraries, and we are pleased to incorporate it into the @@ -109,12 +108,13 @@ to the FAQ.
-terminate
If you are having difficulty with uncaught exceptions and want a little bit of help debugging the causes of the core dumps, you can make use of a GNU extension in GCC 3.1 and later: -
+ +#include <exception> int main() @@ -123,7 +123,6 @@ ... throw anything; }-The
__verbose_terminate_handler
function obtains the name of the current exception, attempts to demangle it, and prints it to stderr. If the exception is derived fromstd::exception
@@ -133,7 +132,8 @@ without returning; this one calls abort.For example: -
+ +#include <exception> #include <stdexcept> @@ -151,9 +151,9 @@ else throw argc; }-In GCC 3.1 and later, this gives -
+ ++% ./a.out terminate called after throwing a `int' Aborted @@ -162,7 +162,7 @@ what(): argc is greater than 5! Aborted %- The 'Aborted' line comes from the call to abort(), of course. +The 'Aborted' line comes from the call to abort(), of course.
Return to top of page or to the FAQ. @@ -171,7 +171,7 @@ -
+
See license.html for copying conditions. Comments and suggestions are welcome, and may be sent to diff --git a/libstdc++-v3/docs/html/20_util/howto.html b/libstdc++-v3/docs/html/20_util/howto.html index b66d557f50e..7b7485ed837 100644 --- a/libstdc++-v3/docs/html/20_util/howto.html +++ b/libstdc++-v3/docs/html/20_util/howto.html @@ -1,13 +1,12 @@ - - - - - - + + + + +
libstdc++-v3 HOWTO: Chapter 20 - + @@ -19,16 +18,16 @@ -
+
Contents
-
-auto_ptr
is not omnipotent -auto_ptr
inside container classes -- Functors -
- Pairs +
- +
auto_ptr
is not omnipotent- +
auto_ptr
inside container classes- Functors
+- Pairs
+
@@ -47,7 +46,8 @@AP is meant to prevent nasty leaks in the presence of exceptions. That's all. This code is AP-friendly: -
+ ++// not a recommend naming scheme, but good for web-based FAQs typedef std::auto_ptr<MyClass> APMC; @@ -62,21 +62,24 @@ function_taking_MyClass_pointer (ap.get()); } -When an exception gets thrown, the instance of MyClass that's +When an exception gets thrown, the instance of MyClass that's been created on the heap will be
delete
'd as the stack is unwound pastfunc()
.Changing that code as follows is not AP-friendly: -
+ ++APMC ap (new MyClass[22]); -You will get the same problems as you would without the use +You will get the same problems as you would without the use of AP: -
+ +char* array = new char[10]; // array new... ... delete array; // ...but single-object delete -- +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 to die. AP is trivial to write, however, so you could write your @@ -87,18 +90,19 @@ to the FAQ.
-
+
auto_ptr
inside container classesAll of the containers described in the standard library require their contained types to have, among other things, a copy constructor like this: -
+ ++struct My_Type { My_Type (My_Type const&); }; -- Note the const keyword; the object being copied shouldn't change. +Note the const keyword; the object being copied shouldn't change. The template class
auto_ptr
(called AP here) does not meet this requirement. Creating a new AP by copying an existing one transfers ownership of the pointed-to object, which means that @@ -113,7 +117,8 @@ concept checks built in to this implementation will issue an error if you try to compile code like this: -+ ++#include <vector> #include <memory> @@ -121,14 +126,14 @@ { std::vector< std::auto_ptr<int> > vec_ap_int; } -- Should you try this with the checks enabled, you will see an error. +Should you try this with the checks enabled, you will see an error.
Return to top of page or to the FAQ.
-
+
Functors
If you don't know what functors are, you're not alone. Many people get slightly the wrong idea. In the interest of not reinventing @@ -141,7 +146,7 @@ to the FAQ.
-
+
Pairs
The
pair<T1,T2>
is a simple and handy way to carry around a pair of objects. One is of type T1, and another of @@ -151,16 +156,20 @@Construction is simple. The default ctor initializes each member with its respective default ctor. The other simple ctor, -
+ ++pair (const T1& x, const T2& y); -does what you think it does,first
gettingx
+does what you think it does,
first
gettingx
andsecond
gettingy
.There is a copy constructor, but it requires that your compiler handle member function templates: -
+ ++template <class U, class V> pain (const pair<U,V>& p); -The compiler will convert as necessary from U to T1 and from +The compiler will convert as necessary from U to T1 and from V to T2 in order to perform the respective initializations.
The comparison operators are done for you. Equality @@ -170,24 +179,25 @@
- -operator==
functions (for types like MyClass) or builtin comparisons (for types like int, char, etc).The less-than operator is a bit odd the first time you see it. It +
+ The less-than operator is a bit odd the first time you see it. It is defined as evaluating to: -
+++x.first < y.first || ( !(y.first < x.first) && x.second < y.second ) -- The other operators are not defined using therel_ops
+The other operators are not defined using the
-rel_ops
functions above, but their semantics are the same.Finally, there is a template function called
make_pair
that takes two references-to-const objects and returns an instance of a pair instantiated on their respective types: -- pair<int,MyClass> p = make_pair(4,myobject); -++ pair<int,MyClass> p = make_pair(4,myobject); +Return to top of page or to the FAQ.
@@ -197,7 +207,7 @@ -
+
See license.html for copying conditions. Comments and suggestions are welcome, and may be sent to diff --git a/libstdc++-v3/docs/html/21_strings/howto.html b/libstdc++-v3/docs/html/21_strings/howto.html index d25dd81bc46..e49a166c0c5 100644 --- a/libstdc++-v3/docs/html/21_strings/howto.html +++ b/libstdc++-v3/docs/html/21_strings/howto.html @@ -1,13 +1,12 @@ - - - - - - + + + + +
- -libstdc++-v3 HOWTO: Chapter 21 - + @@ -18,17 +17,17 @@ -
+
Contents
-
-- MFC's CString -
- A case-insensitive string class -
- Breaking a C++ string into tokens -
- Simple transformations -
- Making strings of arbitrary character types +
- MFC's CString
+- A case-insensitive string class
+- Breaking a C++ string into tokens
+- Simple transformations
+- Making strings of arbitrary character types
+
@@ -43,24 +42,29 @@Things are not as bad as they seem. In this message, Joe Buck points out a few very important things: +
-
- The Standard
string
supports all the operations that CString does, with three exceptions. +- Two of those exceptions (whitespace trimming and case conversion) are trivial to implement. In fact, we do so on this page. +
- The third is
CString::Format
, which allows formatting in the style ofsprintf
. This deserves some mention: +The old libg++ library had a function called form(), which did much +
+#include <iostream> #include <string> #include <sstream> @@ -80,10 +84,10 @@ return output_stream.str(); }-A serious problem with CString is a design bug in its memory allocation. Specifically, quoting from that same message: -
+ +CString suffers from a common programming error that results in poor performance. Consider the following code: @@ -104,22 +108,25 @@ If you replace CString with string in the above function, the performance is O(n). -- +Joe Buck also pointed out some other things to keep in mind when comparing CString and the Standard string class: +
string
.
+ string
operations like this have O(n) complexity
if the implementors do it correctly. The libstdc++
implementors did it correctly. Other vendors might not.
+ string
is essentially
vector<char>
and does not do any reference
@@ -129,13 +136,13 @@
libstdc++ string, the SGI string, and the SGI rope, and this
is all before any allocator or traits customizations! (More
choices than you can shake a stick at -- want fries with that?)
+ Return to top of page or to the FAQ.
-The well-known-and-if-it-isn't-well-known-it-ought-to-be Guru of the Week @@ -144,7 +151,8 @@ is identical to the standard 'string' class, but is case-insensitive in the same way as the (common but nonstandard) C function stricmp():" -
+ +ci_string s( "AbCdE" ); // case insensitive @@ -154,7 +162,6 @@ // still case-preserving, of course assert( strcmp( s.c_str(), "AbCdE" ) == 0 ); assert( strcmp( s.c_str(), "abcde" ) != 0 );-The solution is surprisingly easy. The original answer pages on the GotW website were removed into cold storage, in @@ -189,7 +196,7 @@ to the FAQ.
-
+
Breaking a C++ string into tokens
The Standard C (and C++) function
strtok()
leaves a lot to be desired in terms of user-friendliness. It's unintuitive, it @@ -210,21 +217,23 @@ 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: -+ ++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"; - }- You would see this as output: -+ }+You would see this as output: +
+:this: :is: :a: - :test:- with all the whitespace removed. The originals
is still + :test:with all the whitespace removed. The original
@@ -248,7 +257,7 @@ to the FAQ. -s
is still available for use,ls
will clean up after itself, andls.size()
will return how many tokens there were.
+
Simple transformations
Here are Standard, simple, and portable ways to perform common transformations on a
string
instance, such as "convert @@ -258,7 +267,8 @@This code will go through some iterations (no pun). Here's the simplistic version usually seen on Usenet: -
+ +#include <string> #include <algorithm> #include <cctype> // old <ctype.h> @@ -276,7 +286,7 @@ std::string capital_s; capital_s.reserve(s.size()); std::transform (s.begin(), s.end(), capital_s.begin(), tolower);- Note that these calls all +Note that these calls all involve the global C locale through the use of the C functions
toupper/tolower
. This is absolutely guaranteed to work -- but only if the string contains only characters @@ -287,12 +297,12 @@ characters (hahahahahaha), then you're done.At minimum, you can write short wrappers like -
+ +char toLower (char c) { return tolower(static_cast<unsigned char>(c)); - }- + }The correct method is to use a facet for a particular locale and call its conversion functions. These are discussed more in Chapter 22; the specific part is @@ -304,7 +314,8 @@ like transformations, this task is trivial with the use of string's
find
family. These examples are broken into multiple statements for readability: -+ +std::string str (" \t blah blah blah \n "); // trim leading whitespace @@ -314,7 +325,7 @@ // trim trailing whitespace notwhite = str.find_last_not_of(" \t\n"); str.erase(notwhite+1);- Obviously, the calls tofind
could be inserted directly +Obviously, the calls to
@@ -322,7 +333,7 @@ to the FAQ. -find
could be inserted directly into the calls toerase
, in case your compiler does not optimize named temporaries out of existence.
+
Making strings of arbitrary character types
how to work with char_traits -- in the archives, just need to go through and pull the examples together @@ -335,7 +346,7 @@ -
+
See license.html for copying conditions. Comments and suggestions are welcome, and may be sent to diff --git a/libstdc++-v3/docs/html/22_locale/codecvt.html b/libstdc++-v3/docs/html/22_locale/codecvt.html index a841c35fbce..64f3856d479 100644 --- a/libstdc++-v3/docs/html/22_locale/codecvt.html +++ b/libstdc++-v3/docs/html/22_locale/codecvt.html @@ -1,18 +1,21 @@ - -
- Notes on the codecvt implementation. - + + + + +Notes on the codecvt implementation. +Notes on the codecvt implementation.
- + prepared by Benjamin Kosnik (bkoz@redhat.com) on August 28, 2000 - +
+1. Abstract @@ -33,26 +36,25 @@ wide and narrow characters and the implementation-provided extended functionality are given. -
2. What the standard says
Around page 425 of the C++ Standard, this charming heading comes into view: -+The text around the codecvt definition gives some clues: -22.2.1.5 - Template class codecvt [lib.locale.codecvt] -+- ++ ++ -1- The class codecvt<internT,externT,stateT> is for use when converting from one codeset to another, such as from wide characters to multibyte characters, between wide character encodings such as Unicode and EUC. --Hmm. So, in some unspecified way, Unicode encodings and @@ -60,18 +62,18 @@ translations between other character sets should be handled by this class.
-- ++ ++ -2- The stateT argument selects the pair of codesets being mapped between. --Ah ha! Another clue...
-- ++ ++ -3- The instantiations required in the Table ?? (lib.locale.category), namely codecvt<wchar_t,char,mbstate_t> and codecvt<char,char,mbstate_t>, convert the implementation-defined @@ -83,11 +85,12 @@ mbstate_t perform conversion between encodings known to the library implementor. Other encodings can be converted by specializing on a user-defined stateT type. The stateT object can contain any state that is useful to communicate to or from the specialized do_convert member. --At this point, a couple points become clear: +
One: The standard clearly implies that attempts to add non-required @@ -100,7 +103,6 @@ template parameter, imply an implementation strategy that is mostly (or wholly) based on the underlying C library, and the functions mcsrtombs and wcsrtombs in particular.
-
3. Some thoughts on what would be useful
@@ -121,15 +123,19 @@ represent wide characters, and use an internal encoding of UCS4. (GNU/Linux systems using glibc, in particular.) The C programming language (and thus C++) does not specify a specific size for the type wchar_t. +Thus, portable C++ code cannot assume a byte size (or endianness) either. +
Getting back to the frequently asked question: What about Unicode strings? +
What magic spell will do this conversion? +
A couple of comments: @@ -153,12 +159,14 @@ example, using the iconv family of functions from the Single Unix Specification (what used to be called X/Open) hosted on the GNU/Linux operating system allows bi-directional mapping between far more than the following tantalizing possibilities: +
(An edited list taken from
-`iconv --list`
on a Red Hat 6.2/Intel system: +-++++8859_1, 8859_9, 10646-1:1993, 10646-1:1993/UCS4, ARABIC, ARABIC7, ASCII, EUC-CN, EUC-JP, EUC-KR, EUC-TW, GREEK-CCIcode, GREEK, GREEK7-OLD, GREEK7, GREEK8, HEBREW, ISO-8859-1, ISO-8859-2, ISO-8859-3, @@ -168,8 +176,8 @@ ISO-8859-15, ISO-10646, ISO-10646/UCS2, ISO-10646/UCS4, ISO-10646/UTF-8, ISO-10646/UTF8, SHIFT-JIS, SHIFT_JIS, UCS-2, UCS-4, UCS2, UCS4, UNICODE, UNICODEBIG, UNICODELIcodeLE, US-ASCII, US, UTF-8, UTF-16, UTF8, UTF16). --For iconv-based implementations, string literals for each of the @@ -177,9 +185,12 @@ encodings (ie. "UCS-2" and "UTF-8") are necessary, although for other, non-iconv implementations a table of enumerated values or some other mechanism may be required. +
+
Three problems arise, one big, one of medium importance, and one small. +
First, the small: mcsrtombs and wcsrtombs may not be multithread-safe on all systems required by the GNU tools. For GNU/Linux and glibc, this is not an issue. +
Of medium concern, in the grand scope of things, is that the functions @@ -236,6 +254,7 @@ used to implement this specialization work on null-terminated strings. Buffers, especially file buffers, may not be null-terminated, thus giving conversions that end prematurely or are otherwise incorrect. Yikes! +
The last, and fundamental problem, is the assumption of a global @@ -247,14 +266,15 @@ the GNU C++ library would like to offer a solution that allows multiple locales and or simultaneous usage with computationally correct results. In short, libstdc++-v3 is trying to offer, as an option, a high-quality implementation, damn the additional complexity! +
For the required specialization codecvt<wchar_t, char, mbstate_t> , conversions are made between the internal character set (always UCS4 on GNU/Linux) and whatever the currently selected locale for the LC_CTYPE category implements. +
-
codecvt<char, char, mbstate_t>
+
This is a degenerate (ie, does nothing) specialization. Implementing this was a piece of cake. +
codecvt<char, wchar_t, mbstate_t>
+
This specialization, by specifying all the template parameters, pretty much ties the hands of implementors. As such, the implementation is straightforward, involving mcsrtombs for the conversions between char to wchar_t and wcsrtombs for conversions between wchar_t and char. +
Neither of these two required specializations deals with Unicode characters. As such, libstdc++-v3 implements a partial specialization of the codecvt class with and iconv wrapper class, __enc_traits as the third template parameter. +
This implementation should be standards conformant. First of all, the @@ -293,33 +318,40 @@ non-required conversions. Second of all, the standard says (in Chapter of all, the requirements for the stateT type elsewhere in the standard (see 21.1.2 traits typedefs) only indicate that this type be copy constructible. +
As such, the type __enc_traits is defined as a non-templatized, POD type to be used as the third type of a codecvt instantiation. This type is just a wrapper class for iconv, and provides an easy interface to iconv functionality. +
There are two constructors for __enc_traits: +
__enc_traits() : __in_desc(0), __out_desc(0)
+
This default constructor sets the internal encoding to some default (currently UCS4) and the external encoding to whatever is returned by nl_langinfo(CODESET). +
__enc_traits(const char* __int, const char* __ext)
+
This constructor takes as parameters string literals that indicate the desired internal and external encoding. There are no defaults for either argument. +
One of the issues with iconv is that the string literals identifying @@ -330,24 +362,28 @@ inducing) strategy was implemented: end-users can specify any string (subject to a pre-determined length qualifier, currently 32 bytes) for encodings. It is up to the user to make sure that these strings are valid on the target system. +
void
_M_init()
+
Strangely enough, this member function attempts to open conversion descriptors for a given __enc_traits object. If the conversion descriptors are not valid, the conversion descriptors returned will not be valid and the resulting calls to the codecvt conversion functions will return error. +
bool
_M_good()
+
Provides a way to see if the given __enc_traits object has been properly initialized. If the string literals describing the desired @@ -356,57 +392,60 @@ fail, and this will return false. If the internal and external encodings are valid, but iconv_open could not allocate conversion descriptors, this will also return false. Otherwise, the object is ready to convert and will return true. +
__enc_traits(const __enc_traits&)
+
As iconv allocates memory and sets up conversion descriptors, the copy constructor can only copy the member data pertaining to the internal and external code conversions, and not the conversion descriptors themselves. +
Definitions for all the required codecvt member functions are provided for this specialization, and usage of codecvt<internal character type, external character type, __enc_traits> is consistent with other codecvt usage. +
-
- typedef codecvt_base::result result; - typedef unsigned short unicode_t; - typedef unicode_t int_type; - typedef char ext_type; - typedef __enc_traits enc_type; - typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; - - const ext_type* e_lit = "black pearl jasmine tea"; - int size = strlen(e_lit); - int_type i_lit_base[24] = + typedef codecvt_base::result result; + typedef unsigned short unicode_t; + typedef unicode_t int_type; + typedef char ext_type; + typedef __enc_traits enc_type; + typedef codecvt<int_type, ext_type, enc_type> unicode_codecvt; + + const ext_type* e_lit = "black pearl jasmine tea"; + int size = strlen(e_lit); + int_type i_lit_base[24] = { 25088, 27648, 24832, 25344, 27392, 8192, 28672, 25856, 24832, 29184, 27648, 8192, 27136, 24832, 29440, 27904, 26880, 28160, 25856, 8192, 29696, 25856, 24832, 2560 }; - const int_type* i_lit = i_lit_base; + const int_type* i_lit = i_lit_base; const ext_type* efrom_next; const int_type* ifrom_next; - ext_type* e_arr = new ext_type[size + 1]; - ext_type* eto_next; - int_type* i_arr = new int_type[size + 1]; - int_type* ito_next; + ext_type* e_arr = new ext_type[size + 1]; + ext_type* eto_next; + int_type* i_arr = new int_type[size + 1]; + int_type* ito_next; // construct a locale object with the specialized facet. - locale loc(locale::classic(), new unicode_codecvt); + locale loc(locale::classic(), new unicode_codecvt); // sanity check the constructed locale has the specialized facet. VERIFY( has_facet<unicode_codecvt>(loc) ); const unicode_codecvt& cvt = use_facet<unicode_codecvt>(loc); @@ -414,70 +453,80 @@ codecvt usage. unicode_codecvt::state_type state01("UNICODE", "ISO_8859-1"); initialize_state(state01); result r1 = cvt.in(state01, e_lit, e_lit + size, efrom_next, - i_arr, i_arr + size, ito_next); + i_arr, i_arr + size, ito_next); VERIFY( r1 == codecvt_base::ok ); VERIFY( !int_traits::compare(i_arr, i_lit, size) ); VERIFY( efrom_next == e_lit + size ); VERIFY( ito_next == i_arr + size );-
Drepper, Ulrich, Numerous, late-night email correspondence +
Feather, Clive, "A brief description of Normative Addendum 1," in particular the parts on Extended Character Sets http://www.lysator.liu.se/c/na1.html +
Haible, Bruno, "The Unicode HOWTO" v0.18, 4 August 2000 ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO.html +
ISO/IEC 14882:1998 Programming languages - C++ +
ISO/IEC 9899:1999 Programming languages - C +
Khun, Markus, "UTF-8 and Unicode FAQ for Unix/Linux" http://www.cl.cam.ac.uk/~mgk25/unicode.html +
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000 +
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000 +
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) The Open Group/The Institute of Electrical and Electronics Engineers, Inc. http://www.opennc.org/austin/docreg.html +
diff --git a/libstdc++-v3/docs/html/22_locale/ctype.html b/libstdc++-v3/docs/html/22_locale/ctype.html index a47d9f81ef0..886f83d0739 100644 --- a/libstdc++-v3/docs/html/22_locale/ctype.html +++ b/libstdc++-v3/docs/html/22_locale/ctype.html @@ -1,19 +1,20 @@ - -
ctype<char>
+
This is simple specialization. Implementing this was a piece of cake. +
ctype<wchar_t>
+
This specialization, by specifying all the template parameters, pretty much ties the hands of implementors. As such, the implementation is straightforward, involving mcsrtombs for the conversions between char to wchar_t and wcsrtombs for conversions between wchar_t and char. +
Neither of these two required specializations deals with Unicode characters. As such, libstdc++-v3 implements +
-
Drepper, Ulrich, Numerous, late-night email correspondence +
ISO/IEC 14882:1998 Programming languages - C++ +
ISO/IEC 9899:1999 Programming languages - C +
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000 +
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000 +
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) The Open Group/The Institute of Electrical and Electronics Engineers, Inc. http://www.opennc.org/austin/docreg.html +
diff --git a/libstdc++-v3/docs/html/22_locale/howto.html b/libstdc++-v3/docs/html/22_locale/howto.html index b8fe45d1e59..106662753d9 100644 --- a/libstdc++-v3/docs/html/22_locale/howto.html +++ b/libstdc++-v3/docs/html/22_locale/howto.html @@ -1,13 +1,12 @@ - - - - - - + + + + +Chapter 22 deals with the C++ localization facilities.
-Notes made during the implementation of locales can be found here.
-Notes made during the implementation of codecvt can be found here. @@ -66,19 +65,19 @@ implementation-provided extended functionality are given. -
Notes made during the implementation of ctype can be found here.
-Notes made during the implementation of messages can be found here.
-Dr. Bjarne Stroustrup has released a pointer @@ -96,14 +95,14 @@ avoid it. -
An article entitled "The Standard C++ Locale" was published in Dr. Dobb's Journal and can be found here.
-A very common question on newsgroups and mailing lists is, "How @@ -207,7 +206,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/22_locale/locale.html b/libstdc++-v3/docs/html/22_locale/locale.html
index 630f59986f1..999e82ed0bd 100644
--- a/libstdc++-v3/docs/html/22_locale/locale.html
+++ b/libstdc++-v3/docs/html/22_locale/locale.html
@@ -1,19 +1,20 @@
-
-
Notes on the locale implementation.
-
+
prepared by Benjamin Kosnik (bkoz@redhat.com) on August 8, 2001
-
+
-
-
+
Drepper, Ulrich, Numerous, late-night email correspondence +
ISO/IEC 14882:1998 Programming languages - C++ +
ISO/IEC 9899:1999 Programming languages - C +
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000 +
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000 +
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x) The Open Group/The Institute of Electrical and Electronics Engineers, Inc. http://www.opennc.org/austin/docreg.html +
+ + + + + diff --git a/libstdc++-v3/docs/html/22_locale/messages.html b/libstdc++-v3/docs/html/22_locale/messages.html index 39ee9cfbee7..7497590bd88 100644 --- a/libstdc++-v3/docs/html/22_locale/messages.html +++ b/libstdc++-v3/docs/html/22_locale/messages.html @@ -1,19 +1,20 @@ - -
const char* c = "please"
to a German-localized "bitte"
during program execution.
-+This class has three public member functions, which directly correspond to three protected virtual member functions. @@ -45,51 +45,57 @@ The public member functions are:22.2.7.1 - Template class messages [lib.locale.messages] -+
catalog open(const string&, const locale&) const
+
string_type get(catalog, int, int, const string_type&) const
+
void close(catalog) const
+
While the virtual functions are: +
catalog do_open(const string&, const locale&) const
-
- + ++ ++ -1- Returns: A value that may be passed to get() to retrieve a message, from the message catalog identified by the string name according to an implementation-defined mapping. The result can be used until it is passed to close(). Returns a value less than 0 if no such catalog can be opened. --
string_type do_get(catalog, int, int, const string_type&) const
-
- + ++ ++ -3- Requires: A catalog cat obtained from open() and not yet closed. -4- Returns: A message identified by arguments set, msgid, and dfault, according to an implementation-defined mapping. If no such message can be found, returns dfault. --
void do_close(catalog) const
-
- + ++ + -+ -5- Requires: A catalog cat obtained from open() and not yet closed. -6- Effects: Releases unspecified resources associated with cat. -7- Notes: The limit on such resources, if any, is implementation-defined. --
messages_base::catalog
specified as a typedef
to int? This makes sense for implementations that use
catopen
, but not for others. Fortunately, it's not heavily
used and so only a minor irritant.
+
Second, by making the member functions const
, it is
impossible to save state in them. Thus, storing away information used
in the 'open' member function for use in 'get' is impossible. This is
unfortunate.
+
The 'open' member function in particular seems to be oddly @@ -118,20 +126,22 @@ argument useful? What was the intent? It might make sense if a locale argument was associated with a given default message string in the 'open' member function, for instance. Quite murky and unclear, on reflection. +
Lastly, it seems odd that messages, which explicitly require code conversion, don't use the codecvt facet. Because the messages facet has only one template parameter, it is assumed that ctype, and not codecvt, is to be used to convert between character sets. +
It is implicitly assumed that the locale for the default message string in 'get' is in the "C" locale. Thus, all source code is assumed to be written in English, so translations are always from "en_US" to other, explicitly named locales. +
-
Three different mechanisms have been provided, selectable via configure flags: +
- This model does very little, and is what is used by default. -
- -
- The gnu model is complete and fully tested. It's based on the
- GNU gettext package, which is part of glibc. It uses the functions
- textdomain, bindtextdomain, gettext
- to implement full functionality. Creating message
- catalogs is a relatively straight-forward process and is
- lightly documented below, and fully documented in gettext's
- distributed documentation.
-
- This is a complete, though untested, implementation based on
- the IEEE standard. The functions
- catopen, catgets, catclose
- are used to retrieve locale-specific messages given the
- appropriate message catalogs that have been constructed for
- their use. Note, the script po2msg.sed
that is part
- of the gettext distribution can convert gettext catalogs into
- catalogs that catopen
can use.
-
+ This model does very little, and is what is used by default. +
+
+ The gnu model is complete and fully tested. It's based on the
+ GNU gettext package, which is part of glibc. It uses the functions
+ textdomain, bindtextdomain, gettext
+ to implement full functionality. Creating message
+ catalogs is a relatively straight-forward process and is
+ lightly documented below, and fully documented in gettext's
+ distributed documentation.
+
+ This is a complete, though untested, implementation based on
+ the IEEE standard. The functions
+ catopen, catgets, catclose
+ are used to retrieve locale-specific messages given the
+ appropriate message catalogs that have been constructed for
+ their use. Note, the script po2msg.sed
that is part
+ of the gettext distribution can convert gettext catalogs into
+ catalogs that catopen
can use.
+
@@ -181,9 +195,11 @@ A new, standards-conformant non-virtual member function signature was added for 'open' so that a directory could be specified with a given message catalog. This simplifies calling conventions for the gnu model. +
The rest of this document discusses details of the GNU model. +
The messages facet, because it is retrieving and converting between
@@ -193,67 +209,79 @@ necessary for more than just the LC_MESSAGES
mask:
LC_CTYPE
is also necessary. To avoid any unpleasantness, all
bits of the "C" mask (ie LC_ALL
) are set before retrieving
messages.
+
Making the message catalogs can be initially tricky, but become quite simple with practice. For complete info, see the gettext documentation. Here's an idea of what is required: +
intl/string_literals.cc
for an example.
-
- -
- xgettext --c++ --debug string_literals.cc -o libstdc++.pot
-
-
-
- cp libstdc++.pot fr_FR.po
-
- cp libstdc++.pot de_DE.po
-
-
-
- emacs fr_FR.po
-
-
-
- msgfmt fr_FR.po -o fr_FR.mo
-
- msgfmt de_DE.po -o de_DE.mo
-
-
-
- cp fr_FR.mo (dir)/fr_FR/LC_MESSAGES/libstdc++-v3.mo
-
- cp de_DE.mo (dir)/de_DE/LC_MESSAGES/libstdc++-v3.mo
-
-
-
- locale loc_de("de_DE");
-
-
- use_facet<messages<char> >(loc_de).open("libstdc++", locale(), dir);
-
+
intl/string_literals.cc
for an example.
+
+ xgettext --c++ --debug string_literals.cc -o libstdc++.pot
+
+ cp libstdc++.pot fr_FR.po
+
+ cp libstdc++.pot de_DE.po
+
+ emacs fr_FR.po
+
+ msgfmt fr_FR.po -o fr_FR.mo
+
+ msgfmt de_DE.po -o de_DE.mo
+
+ cp fr_FR.mo (dir)/fr_FR/LC_MESSAGES/libstdc++-v3.mo
+
+ cp de_DE.mo (dir)/de_DE/LC_MESSAGES/libstdc++-v3.mo
+
+ locale loc_de("de_DE");
+
+
+ use_facet<messages<char> >(loc_de).open("libstdc++", locale(), dir);
+
+
#include <iostream> @@ -276,82 +304,87 @@ void test01() mssg_de.close(cat_de); }+
-
+
-
-
+ std::messages facilities to implement truename/falename
+ correctly. This is currently not done, but entries in
+ libstdc++.pot have already been made for "true" and "false"
+ string literals, so all that remains is the std::numpunct
+ coding and the configure/make hassles to make the installed
+ library search its own catalog. Currently the libstdc++.mo
+ catalog is only searched for the testsuite cases involving
+ messages members.
+
+
catalog
open(const basic_string<char>& __s, const locale& __loc) const
-
-
-
-
- catalog
- open(const basic_string<char>&, const locale&, const char*) const;
-
-
-
- Don't actually return a "value less than 0 if no such catalog - can be opened" as required by the standard in the "gnu" - model. As of this writing, it is unknown how to query to see - if a specified message catalog exists using the gettext - package. + +
+ +
+
+ catalog
+ open(const basic_string<char>&, const locale&, const char*) const;
+
+
+ Don't actually return a "value less than 0 if no such catalog + can be opened" as required by the standard in the "gnu" + model. As of this writing, it is unknown how to query to see + if a specified message catalog exists using the gettext + package. +
+
Drepper, Ulrich, Numerous, late-night email correspondence +
ISO/IEC 9899:1999 Programming languages - C +
ISO/IEC 14882:1998 Programming languages - C++ +
Java 2 Platform, Standard Edition, v 1.3.1 API Specification. In particular, java.util.Properties, java.text.MessageFormat, java.util.Locale, java.util.ResourceBundle. http://java.sun.com/j2se/1.3/docs/api +
System Interface Definitions, Issue 7 (IEEE Std. 1003.1-200x) The Open Group/The Institute of Electrical and Electronics Engineers, Inc. In particular see lines 5268-5427. http://www.opennc.org/austin/docreg.html +
GNU gettext tools, version 0.10.38, Native Language Support Library and Tools. http://sources.redhat.com/gettext +
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000. See page 725, Internationalized Messages. +
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000 +
+ + + + diff --git a/libstdc++-v3/docs/html/23_containers/howto.html b/libstdc++-v3/docs/html/23_containers/howto.html index a64d79c75ae..1c1e137b67c 100644 --- a/libstdc++-v3/docs/html/23_containers/howto.html +++ b/libstdc++-v3/docs/html/23_containers/howto.html @@ -1,13 +1,12 @@ - - - - - - + + + + +std::list::size()
is O(n)!
- std::list::size()
is O(n)!The result is that if all your algorithm calls look like -
+ +std::transform(beginof(foo), endof(foo), beginof(foo), SomeFunction);- then the type of foo can change from an array of ints to a vector +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.
@@ -86,19 +86,21 @@ give the extra three lines and avoid confusion.Second, the line -
+ +inline unsigned int lengthof (T (&)[sz]) { return sz; }- looks just weird! Hint: unused parameters can be left nameless. +looks just weird! Hint: unused parameters can be left nameless.
Return to top of page or to the FAQ.
-
+
Variable-sized bitmasks
No, you cannot write code of the form +
-+#include <bitset> void foo (size_t n) @@ -106,19 +108,19 @@ std::bitset<n> bits; .... }- becausen
must be known at compile time. Your compiler is +because
n
must be known at compile time. Your compiler is correct; it is not a bug. That's the way templates work. (Yes, it is a feature.)There are a couple of ways to handle this kind of thing. Please consider all of them before passing judgement. They include, in no particular order: +
bitset<N>
.
- bitset<N>
.A very large N in
bitset<N>
. It has
been pointed out a few times in newsgroups that N bits only takes up
@@ -192,7 +194,7 @@
to the FAQ.
This section discusses issues surrounding the design of multithreaded applications which use Standard C++ containers. @@ -204,14 +206,14 @@ multithreading as it relates to libstdc++, including details on the proper compilation of threaded code (and compatibility between threaded and non-threaded code), see Chapter 17. -
+Two excellent pages to read when working with the Standard C++ containers and threads are SGI's http://www.sgi.com/tech/stl/thread_safety.html and SGI's http://www.sgi.com/tech/stl/Allocators.html. -
+However, please ignore all discussions about the user-level configuration of the lock implementation inside the STL container-memory allocator on those pages. For the sake of this @@ -223,7 +225,7 @@ STL. This is no longer required for any port and should no longer be done unless you really know what you are doing and assume all responsibility. -
+Since the container implementation of libstdc++-v3 uses the SGI code, we use the same definition of thread safety as SGI when discussing design. A key point that beginners may miss is the @@ -235,7 +237,7 @@ element is constructed uses an internal lock obtained and released solely within libstdc++-v3 code (in fact, this is the reason STL requires any knowledge of the thread configuration). -
+For implementing a container which does its own locking, it is trivial to provide a wrapper class which obtains the lock (as SGI suggests), performs the container operation, and then @@ -249,7 +251,8 @@ you must change this on a global basis for your platform to better support multi-threading, then please consult all commentary in include/bits/stl_alloc.h and the allocators link below. -
+ ++- If you find any platform where gcc reports a +(Explicit warning since so many people get confused while attempting this:)
@@ -271,8 +274,8 @@ one-definition rule of C/C++ and you might cause yourself untold problems. -
If you find any platform where gcc reports a threading model other than single, and where libstdc++-v3 builds a buggy container allocator when used with threads unless you define __USE_MALLOC, we want to hear about it ASAP. In the @@ -290,13 +293,14 @@ to the FAQ.
-Section [23.1.2], Table 69, of the C++ standard lists this function for all of the associative containers (map, set, etc): -
+ +a.insert(p,t);- where 'p' is an iterator into the container 'a', and 't' is the item +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 specifies nothing more. (LWG Issue #233, currently in review, @@ -321,23 +325,26 @@ their new meanings in the next paragraph. *grin*
If the
hint
parameter ('p' above) is equivalent to: +
begin()
, then the item being inserted should have a key
less than all the other keys in the container. The item will
be inserted at the beginning of the container, becoming the new
entry at begin()
.
+ end()
, then the item being inserted should have a key
greater than all the other keys in the container. The item will
be inserted at the end of the container, becoming the new entry
at end()
.
+ begin()
nor end()
, then: Let h
be the entry in the container pointed to by hint
, that
is, h = *hint
. Then the item being inserted should have
a key less than that of h
, and greater than that of the
item preceding h
. The new item will be inserted
between h
and h
's predecessor.
+ For multimap
and multiset
, the restrictions are
slightly looser: "greater than" should be replaced by
"not less than" and "less than" should be replaced
@@ -372,7 +379,7 @@
to the FAQ.
Bitmasks do not take char* nor const char* arguments in their constructors. This is something of an accident, but you can read @@ -383,6 +390,7 @@
For now you can simply make a temporary string object using the constructor expression: +
std::bitset<5> b ( std::string("10110") );@@ -390,17 +398,17 @@
std::bitset<5> b ( "10110" ); // invalid-
Return to top of page or to the FAQ.
-std::list::size()
is O(n)!Yes it is, and that's okay. This is a decision that we preserved when we imported SGI's STL implementation. The following is quoted from their FAQ: -
+ +- +The size() member function, for list and slist, takes time proportional to the number of elements in the list. This was a deliberate tradeoff. The only way to get a constant-time size() for @@ -419,6 +427,7 @@ is supposed to do something unless there is a good reason not to.
One implication of linear time size(): you should never write +
if (L.size() == 0) ...@@ -426,15 +435,13 @@if (L.empty()) ...- -
Return to top of page or to the FAQ.
-In this message to the list, Daniel Kostecky announced work on an @@ -457,7 +464,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/24_iterators/howto.html b/libstdc++-v3/docs/html/24_iterators/howto.html
index 90c53df18ac..4d48cffdcbd 100644
--- a/libstdc++-v3/docs/html/24_iterators/howto.html
+++ b/libstdc++-v3/docs/html/24_iterators/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
Contents
-
+
@@ -67,41 +66,46 @@
to the FAQ.
This starts off sounding complicated, but is actually very easy, especially towards the end. Trust me. -
+Beginners usually have a little trouble understand the whole 'past-the-end' thing, until they remember their early algebra classes - (see, they told you that stuff would come in handy!) and + (see, they told you that stuff would come in handy!) and the concept of half-open ranges.
First, some history, and a reminder of some of the funkier rules in C and C++ for builtin arrays. The following rules have always been true for both languages: -
The reason this past-the-end addressing was allowed is to make it easy to write a loop to go over an entire array, e.g., while (*d++ = *s++);.
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 boundary markers: -
+ ++beginning end | | @@ -121,8 +125,8 @@ | | dereference 'end'. beginning end -- See? Everything between the boundary markers is part of the array. +
See? Everything between the boundary markers is part of the array. Simple.
Now think back to your junior-high school algebra course, when you @@ -171,7 +175,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/25_algorithms/howto.html b/libstdc++-v3/docs/html/25_algorithms/howto.html
index 8cdfe94a471..65403ca8159 100644
--- a/libstdc++-v3/docs/html/25_algorithms/howto.html
+++ b/libstdc++-v3/docs/html/25_algorithms/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
The neatest accomplishment of the algorithms chapter is that all the
work is done via iterators, not containers directly. This means two
important things:
-
+
Contents
-
+
@@ -34,16 +33,18 @@
-
Even strings can be fed through the algorithms here, although the
string class has specialized versions of many of these functions (for
example, string::find()
). Most of the examples on this
@@ -67,7 +68,7 @@
to the FAQ.
swap
sIf you call std::swap(x,y);
where x and y are standard
containers, then the call will automatically be replaced by a call to
@@ -90,7 +91,7 @@
-
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/26_numerics/howto.html b/libstdc++-v3/docs/html/26_numerics/howto.html
index e15870f57bf..067f59dd0fd 100644
--- a/libstdc++-v3/docs/html/26_numerics/howto.html
+++ b/libstdc++-v3/docs/html/26_numerics/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
Chapter 26 deals with building block abstractions to aid in
numerical computing:
-
-
- All of the Standard C math functions are of course included in C++,
+valarray<>
- and complex<>
.
- accumulate
,
- inner_product
, partial_sum
, and
- adjacent_difference
.
-
valarray<>
+ and complex<>
.
+ accumulate
,
+ inner_product
, partial_sum
, and
+ adjacent_difference
.
+ All of the Standard C math functions are of course included in C++,
and overloaded versions for long
, float
, and
long double
have been added for all of them.
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 @@ -87,22 +89,23 @@ to the FAQ.
-There are four generalized functions in the <numeric> header that follow the same conventions as those in <algorithm>. Each of them is overloaded: one signature for common default operations, and a second for fully general operations. Their names are self-explanatory to anyone who works with numerics on a regular basis: -
accumulate
- inner_product
- partial_sum
- adjacent_difference
- accumulate
inner_product
partial_sum
adjacent_difference
Here is a simple example of the two forms of accumulate
.
-
+ ++int ar[50]; int someval = somefunction(); @@ -111,8 +114,8 @@ 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>()); -- The first call adds all the members of the array, using zero as an +
The first call adds all the members of the array, using zero as an
initial value for sum
. The second does the same, but uses
someval
as the starting value (thus, sum_stuff == sum +
someval
). The final call uses the second of the two signatures,
@@ -125,7 +128,7 @@
to the FAQ.
In addition to the other topics on this page, we'll note here some of the C99 features that appear in libstdc++-v3. @@ -151,7 +154,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/27_io/howto.html b/libstdc++-v3/docs/html/27_io/howto.html
index bf235560dfa..94b0e015fba 100644
--- a/libstdc++-v3/docs/html/27_io/howto.html
+++ b/libstdc++-v3/docs/html/27_io/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
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):
-
+
Contents
-
-
+
@@ -40,27 +39,29 @@
+
#include <fstream> std::ifstream IN ("input_file"); std::ofstream OUT ("output_file");-
Here's the easiest way to get it completely wrong: -
+ ++OUT << IN;- For those of you who don't already know why this doesn't work +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 +
- The quick brown fox jumped over the lazy dog.- surrounded by blank lines. Code it up and try it. The contents + The quick brown fox jumped over the lazy dog.
surrounded by blank lines. Code it up and try it. The contents of "output_file" may surprise you.
Seriously, go do it. Get surprised, then come back. It's worth it.
-The thing to remember is that the basic_[io]stream
classes
handle formatting, nothing else. In particular, they break up on
whitespace. The actual reading, writing, and storing of data is
@@ -76,9 +77,9 @@
as well as the streams themselves. The pointer is easily retrieved
using the rdbuf()
member function. Therefore, the easiest
way to copy the file is:
-
- OUT << IN.rdbuf();+
+ OUT << IN.rdbuf();
So what was happening with OUT<<IN? Undefined behavior, since that particular << isn't defined by the Standard. I have seen instances where it is implemented, but the character @@ -89,7 +90,7 @@ file then contains a perfect text representation of a hexidecimal address (quite a big surprise). Others don't compile at all.
-Also note that none of this is specific to o*f*streams. +
Also note that none of this is specific to o*f*streams. The operators shown above are all defined in the parent basic_ostream class and are therefore available with all possible descendents. @@ -98,7 +99,7 @@ to the FAQ.
-
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/Makefile b/libstdc++-v3/docs/html/Makefile
index a494e2de975..efc75bec86f 100644
--- a/libstdc++-v3/docs/html/Makefile
+++ b/libstdc++-v3/docs/html/Makefile
@@ -13,7 +13,7 @@ documentation.html: $(wildcard */howto.html)
sed -n '1,/beginlist/p' $@ > tmp.top
sed -n '/endlist/,$$p' $@ > tmp.bottom
echo ' ' > tmp.middle
- for i in [[:digit:]]*/howto.html; do \
+ for i in [0-9]*/howto.html; do \
title=`grep 'h1 ' $$i |\
sed 's=.*\(Chapter [[:digit:]]*\):[[:space:]]*\(.*\).*=\2 (\1)='` ;\
awk -v file=$$i -v "title=$$title" -f makedoc.awk $$i >> tmp.middle ;\
diff --git a/libstdc++-v3/docs/html/configopts.html b/libstdc++-v3/docs/html/configopts.html
index 4fae2659799..296c509758f 100644
--- a/libstdc++-v3/docs/html/configopts.html
+++ b/libstdc++-v3/docs/html/configopts.html
@@ -1,12 +1,11 @@
-
-
-
-
-
+
+
+
+
To the libstdc++-v3 homepage. - +
-Here are some of the non-obvious options to libstdc++'s configure. Keep in mind that @@ -37,15 +36,16 @@ options
--enable-multilib
[default]
+ --enable-multilib
[default]This is part of the generic multilib support for building cross compilers. As such, targets like "powerpc-elf" will have libstdc++ built many different ways: "-msoft-float" and not, etc. A different libstdc++ will be built for each of the different multilib versions. This option is on by default.
+--enable-debug
+ --enable-debug
The configure script will automatically detect the highest
level of optimization that the compiler in use can use.
This --enable flag will disable all optimizations and instruct
@@ -55,13 +55,15 @@ options
configuration difference:
make CXXFLAGS='-g -O0' all
--enable-cstdio
+ --enable-cstdio
This is an abbreviated form of '--enable-cstdio=stdio'
(described next).
--enable-cstdio=LIB
+ --enable-cstdio=LIB
Select a target-specific I/O package. As of libstdc++-v3 snapshot 3.0.96, the choices are 'libio' to specify the GNU I/O package (from @@ -70,32 +72,36 @@ options abstraction. The default is 'stdio'. A longer explanation is here.
+--enable-sjlj-exceptions
+ --enable-sjlj-exceptions
Forces old, set-jump/long-jump exception handling model. If at all possible, the new, frame unwinding exception handling routines should be used instead, as they significantly reduce both runtime memory usage and executable size.
+--enable-clocale
+ --enable-clocale
This is an abbreviated form of '--enable-clocale=generic'
(described next).
--enable-clocale=MODEL
+ --enable-clocale=MODEL
Select a target-specific underlying locale package. The choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix (IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets, 'gnu' to specify a model based on functionality from the GNU C - library (langinfo/iconv/gettext) (from glibc, the GNU C library), or 'generic' to use a generic "C" abstraction which consists of "C" locale info. The default is 'generic'.
+--enable-c99
+ --enable-c99
The "long long" type was introduced in C99, along with many other functions for wide characters, and math classification macros, etc. If enabled, all C99 functions not @@ -108,8 +114,9 @@ options configure probes find all the necessary functions and bits necessary.
+--enable-long-long
+ --enable-long-long
The "long long" type was introduced in C99. It is provided as a GNU extension to C++98 in g++. This flag builds support for "long long" into the library (specialized @@ -121,26 +128,30 @@ options the flag is -D_ISOC99_SOURCE, which is added automatically via CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE).
+--enable-cheaders=OPTION
+ --enable-cheaders=OPTION
This allows the user to define what kind of C headers are used. Options are: c, c_std, and c_shadow. These correspond to the source directory's include/c, include/c_std, and include/c_shadow directories. The default is c_std.
+--enable-threads
+ --enable-threads
This is an abbreviated form of '--enable-threads=yes'
(described next).
--enable-threads=LIB
+ --enable-threads=LIB
Select a threading library. A full description is given in the general compiler configuration instructions.
+--enable-version-specific-runtime-libs
+ --enable-version-specific-runtime-libs
Specify that run-time libraries should be installed in the
compiler-specific subdirectory (i.e.,
${libdir}/gcc-lib/${target_alias}/${gcc_version}
)
@@ -151,17 +162,18 @@ options
unless you also specify
--with-gxx-include-dir=dirname
during configuration.
--with-gxx-include-dir=<include-files dir>
+ --with-gxx-include-dir=<include-files dir>
Adds support for named libstdc++ include directory. For instance, the following puts all the libstdc++ headers into a directory called "2.97-20001008" instead of the usual "g++-v3".
- --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008+ --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008
--enable-cxx-flags=FLAGS
+ --enable-cxx-flags=FLAGS
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 @@ -188,8 +200,9 @@ options
and opposite forms (-fno-) of the same. Tell us (the libstdc++ mailing list) if you discover more!
+--enable-c-mbchar
[default]
+ --enable-c-mbchar
[default]Certain template specializations are required for wide character conversion support. This is tricky and currently changing rapidly, and can cause problems on new platforms. @@ -197,16 +210,18 @@ options porting steps, but builds only a subset of what is required by ISO. By default, this option is on.
+--enable-concept-checks
+ --enable-concept-checks
This turns on additional compile-time checks for instantiated library templates, in the form of specialized templates, described here. They can help users discover when they break the rules of the STL, before their programs run.
+--enable-symvers[=style]
+ --enable-symvers[=style]
In 3.1, tries to turn on symbol versioning in the shared library (if a shared library has been requested). The only 'style' currently supported is 'gnu' which requires that a recent version of the GNU @@ -214,6 +229,7 @@ options try to guess if the 'gnu' style can be used, and if so, will turn it on. Hopefully people will volunteer to do other 'style' options.
+Return to the top of the page or to the libstdc++ homepage. @@ -222,7 +238,7 @@ options -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/documentation.html b/libstdc++-v3/docs/html/documentation.html
index b1640d041ff..aba38723747 100644
--- a/libstdc++-v3/docs/html/documentation.html
+++ b/libstdc++-v3/docs/html/documentation.html
@@ -1,10 +1,9 @@
-
+ content="libstdc++, homepage, home, C++, library, c++, std, g++, ABI, STL" />
This is a short list of text files pertaining to this implementation of ISO 14882. A brief description may follow the name of the file. +
The library sources have been specially formatted so that with the proper invocation of another tool (Doxygen), a set of HTML pages @@ -58,13 +57,16 @@ the library classes, finding out what is in a particular include file, looking at inheritance diagrams, etc.
-The Source-Level documentation can be viewed online: -
The Source-Level documentation can be viewed online:
+This generated HTML collection, as above, is also available for download in
the libstdc++ snapshots directory at
<URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>
.
@@ -81,7 +83,7 @@
Information, extensions, notes and advice on specific implementation capabilites and/or liabilities broken down into chapter names based on the @@ -95,7 +97,7 @@ -->
To the libstdc++-v3 homepage. +
---enable-cstdio
--enable-cstdio
In addition to all the nifty things which C++ can do for I/O, its library also includes all of the I/O capabilites of C. Making them work together can be a challenge, not only @@ -61,8 +61,8 @@ design
-
Return to the top of the page or @@ -72,7 +72,7 @@ design -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/ext/howto.html b/libstdc++-v3/docs/html/ext/howto.html
index d5755c6cd67..b4f6dae6f14 100644
--- a/libstdc++-v3/docs/html/ext/howto.html
+++ b/libstdc++-v3/docs/html/ext/howto.html
@@ -1,13 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
Before you leap in and use these, be aware of two things: -
The SGI headers -
++The SGI headers
+<bvector> <hash_map> <hash_set> <rope> <slist> <tree> -are all here;<bvector>
exposes the old bit_vector +
are all here; <bvector>
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).
<hash_map>
and <hash_set>
@@ -88,25 +88,25 @@
Why would you want to use a hashing class instead of the "normal" implementations? Matt Austern writes: -
[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.+
[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.
(Side note: for those of you wondering, "Why wasn't a hash table included in the Standard in the first #!$@ place?" 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. + included in a future Standard.)
Return to top of page or to the FAQ.
-Some of the classes in the Standard Library have additional publicly-available members, and some classes are themselves not in @@ -114,29 +114,32 @@ for example, additional typedefs. Those won't be described here (or anywhere else).
--
filebuf
s have another ctor with this signature:basic_filebuf(__c_file_type*, ios_base::openmode, int_type);
- filebuf
s have another ctor with this signature:
+ basic_filebuf(__c_file_type*, ios_base::openmode, int_type);
+ __c_file_type* F
// the __c_file_type typedef usually boils down to stdio's FILE
+ ios_base::openmode M
// same as all the other uses of openmode
+ int_type B
// buffer size, defaults to BUFSIZ if not specified
+ fdopen()
.
- filebuf
s bring
back an old extension: the fd()
member function. The
integer returned from this function can be used for whatever file
@@ -144,31 +147,35 @@
library cannot track what you do on your own with a file descriptor,
so if you perform any I/O directly, don't expect the library to be
aware of it.
+ filebuf
constructor and
the fd()
function were removed from the standard
filebuf. Instead, <ext/stdio_filebuf.h>
contains
a derived class called __gnu_cxx::stdio_filebuf
.
- Return to top of page or to the FAQ.
-Thread-safety, space efficiency, high speed, portability... this is a mess. Where to begin?
The C++ standard only gives a few directives in this area: -
Allocator
template parameter. This includes adding
char's to the string class, which acts as a regular STL container
in this respect.
+ Allocator
of every container-of-T is
std::allocator<T>
.
+ allocator<T>
class is
extremely simple. It has about 20 public declarations (nested
typedefs, member functions, etc), but the two which concern us most
@@ -180,13 +187,14 @@
The "n"
arguments in both those functions is a
count of the number of T's to allocate space for,
not their total size.
+ ::operator new(size_t)
, but it is unspecified when or
how often this function is called. The use of hint
is unspecified, but intended as an aid to locality if an
implementation so desires." [20.4.1.1]/6
- The easiest way of fulfilling the requirements is to call operator new each time a container needs memory, and to call operator delete each @@ -235,33 +243,39 @@ information for maintainers and contributors in addition to users.
These classes are always available: -
__new_alloc
simply wraps ::operator new
and ::operator delete
.
+ __malloc_alloc_template<int inst>
simply wraps
malloc
and free
. There is also a hook
for an out-of-memory handler (for new/delete this is taken care of
elsewhere). The inst
parameter is described below.
This class was called malloc_alloc
in earlier versions.
+ allocator<T>
has already been described; it is
The Standard Allocator for instances of T. It uses the internal
__alloc
typedef (see below) to satisy its requests.
+ __simple_alloc<T,A>
is a wrapper around another
allocator, A, which itself is an allocator for instances of T.
This is primarily used in an internal "allocator traits"
class which helps encapsulate the different styles of allocators.
+ __debug_alloc<A>
is also a wrapper around an
arbitrary allocator A. It passes on slightly increased size
requests to A, and uses the extra memory to store size information.
When a pointer is passed to deallocate()
, the stored
size is checked, and assert() is used to guarantee they match.
+ __allocator<T,A>
is an adaptor. Many of these
allocator classes have a consistent yet non-standard interface.
Such classes can be changed to a conforming interface with this
wrapper: __allocator<T, __alloc>
is thus the
same as allocator<T>
.
- An internal typedef, __mem_interface
, is defined to be
__new_alloc
by default.
If you've already read this advice and decided to define this macro, then the situation changes thusly: -
__mem_interface
, and
- __alloc
, and
+
+ __mem_interface
, and__alloc
, and__single_client_alloc
are all typedef'd to
- __malloc_alloc_template
.
+ __malloc_alloc_template
.__default_alloc_template
is no longer available.
- At all. Anywhere.
- Depending on your application (a specific program, a generic library, etc), allocator classes tend to be one of two styles: "SGI" @@ -326,12 +340,12 @@ (but nonportable) method of specifying that only malloc/free should be used instead of the default node allocator is: -
+ +std::list <my_type, std::__malloc_alloc_template<0> > my_malloc_based_list;Likewise, a debugging form of whichever allocator is currently in use:std::deque <my_type, std::__debug_alloc<std::__alloc> > debug_deque;-
inst
The
__malloc_alloc_template
and__default_alloc_template
classes take an integer parameter, @@ -339,11 +353,12 @@The point of the number is to allow multiple instantiations of the classes without changing the semantics at all. All three of -
+ +typedef __default_alloc_template<true,0> normal; typedef __default_alloc_template<true,1> private; typedef __default_alloc_template<true,42> also_private;- behave exactly the same way. However, the memory pool for each type +behave exactly the same way. However, the memory pool for each type (and remember that different instantiations result in different types) remains separate.
@@ -365,7 +380,7 @@ to the FAQ. -
+
Allocators (version 3.3)
Changes are coming...
@@ -373,7 +388,7 @@ to the FAQ. -
+
Compile-time checks
Currently libstdc++-v3 uses the concept checkers from the Boost library to perform optional @@ -384,7 +399,7 @@ to the FAQ.
-
+
LWG Issues
Everybody's got issues. Even the C++ Standard Library.
@@ -418,134 +433,188 @@ examples of style. Note that we usually do not make changes to the code until an issue has reached DR status. -
ios_base::failure
is constructed instead.
+ private
and are
thus inaccessible. Specifying the correct semantics of
"copying stream state" was deemed too complicated.
+ max_size()
rather than npos
.
+ binder1st
and binder2nd
didn't have an
operator()
taking a non-const parameter.
+ num_put::put()
was overloaded on the wrong types.
+ num_get::get()
.
+ failbit
on error now.
+ seekp
should only set the output stream, and
seekg
should only set the input stream.
+ underflow()
.
+ -->
op<<
with a const char*
was
calculating an incorrect number of characters to write.
+ op>>
now
sets failbit
(which can cause an exception, etc, etc).
+ set
and multiset
were missing
overloaded find, lower_bound, upper_bound, and equal_range functions
for const instances.
+ bad_
* classes no longer have destructors (they
are trivial), since no description of them was ever given.
+ Return to top of page or to the FAQ.
@@ -553,7 +622,7 @@ -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/ext/sgiexts.html b/libstdc++-v3/docs/html/ext/sgiexts.html
index 674ffacc766..eed0a16d694 100644
--- a/libstdc++-v3/docs/html/ext/sgiexts.html
+++ b/libstdc++-v3/docs/html/ext/sgiexts.html
@@ -1,12 +1,11 @@
-
-
-
-
-
+
+
+
+
Descriptions range from the scanty to the verbose. You should also check @@ -36,30 +35,33 @@ libstdc++-v3
Back to the libstdc++-v3 extensions. +
-The <functional> header contains many additional functors and helper functions, extending section 20.3. They are implemented in the file stl_function.h: -
identity_element
for addition and multiplication. *
- identity
, whose op() returns the argument
- unchanged. *
+
+identity_element
for addition and multiplication. * identity
, whose operator()
+ returns the argument unchanged. * unary_function
and
binary_function
, and their helpers compose1
- and compose2
. *
- select1st
and select2nd
, to strip pairs. *
- project1st
and project2nd
. *
+ and compose2
. * select1st
and select2nd
, to strip pairs. * project1st
and project2nd
. * constant_void_fun, constant_binary_fun, constant_unary_fun,
- constant0, constant1, and constant2. *
- - The class
subtractive_rng
. *
- - mem_fun adaptor helpers mem_fun1 and mem_fun1_ref are provided for
- backwards compatibility.
-
constant_void_fun
, constant_binary_fun
,
+ constant_unary_fun
, constant0
,
+ constant1
, and constant2
. * subtractive_rng
. * mem_fun1
and
+ mem_fun1_ref
are provided for backwards compatibility. 20.4.1 can use several different allocators; they are described on the main extensions page.
@@ -68,12 +70,12 @@ libstdc++-v3 is a pointer, which is ignored, but can be used to specify the template type (instead of using explicit function template arguments like the standard version does). That is, in addition to +get_temporary_buffer<int>(5);you can also use
get_temporary_buffer(5, (int*)0);-
A class temporary_buffer
is given in stl_tempbuf.h. *
The specialized algorithms of section 20.4.4 are extended with @@ -84,8 +86,8 @@ libstdc++-v3
-A few extensions and nods to backwards-compatibility have been made with containers. Those dealing with older SGI-style allocators are dealt with elsewhere. The remaining ones all deal with bits: @@ -105,18 +107,18 @@ libstdc++-v3 versions of single-bit test, set, reset, and flip member functions which do no range-checking. If we call them member functions of an instantiation of "bitset<N>," then their names and signatures are: +
bitset<N>& _Unchecked_set (size_t pos); bitset<N>& _Unchecked_set (size_t pos, int val); bitset<N>& _Unchecked_reset (size_t pos); bitset<N>& _Unchecked_flip (size_t pos); bool _Unchecked_test (size_t pos);- Note that these may in fact be removed in the future, although we have +
Note that these may in fact be removed in the future, although we have no present plans to do so (and there doesn't seem to be any immediate reason to).
-
- The semantics of member function operator[]
are not specified
+
The semantics of member function operator[]
are not specified
in the C++ standard. A long-standing defect report calls for sensible
obvious semantics, which are already implemented here: op[]
on a const bitset returns a bool, and for a non-const bitset returns a
@@ -128,30 +130,31 @@ libstdc++-v3
Finally, two additional searching functions have been added. They return
the index of the first "on" bit, and the index of the first
"on" bit that is after prev
, respectively:
+
size_t _Find_first() const; size_t _Find_next (size_t prev) const;- The same caveat given for the _Unchecked_* functions applies here also. +
The same caveat given for the _Unchecked_* functions applies here also.
Return to the main extensions page or to the homepage.
-24.3.2 describes struct iterator
, which didn't exist in the
original HP STL implementation (the language wasn't rich enough at the
time). For backwards compatibility, base classes are provided which
declare the same nested typedefs:
+
24.3.4 describes iterator operation distance
, which takes
two iterators and returns a result. It is extended by another signature
which takes two iterators and a reference to a result. The result is
@@ -162,50 +165,53 @@ libstdc++-v3
25.1.6 (count, count_if) is extended with two more versions of count and count_if. The standard versions return their results. The additional signatures return void, but take a final parameter by reference to which they assign their results, e.g., +
void count (first, last, value, n);-
25.2 (mutating algorithms) is extended with two families of signatures, random_sample and random_sample_n.
25.2.1 (copy) is extended with +
copy_n (_InputIter first, _Size count, _OutputIter result);- which copies the first 'count' elements at 'first' into 'result'. +
which copies the first 'count' elements at 'first' into 'result'.
25.3 (sorting 'n' heaps 'n' stuff) is extended with some helper predicates. Look in the doxygen-generated pages for notes on these. +
is_heap
tests whether or not a range is a heap.
+ is_heap
tests whether or not a range is a heap.is_sorted
tests whether or not a range is sorted in
- nondescending order.
+ nondescending order.25.3.8 (lexigraphical_compare) is extended with +
lexicographical_compare_3way(_InputIter1 first1, _InputIter1 last1, _InputIter2 first2, _InputIter2 last2)- which does... what? +
which does... what?
Return to the main extensions page or to the homepage.
-26.4, the generalized numeric operations such as accumulate, are extended with the following functions: +
power (x, n); power (x, n, moniod_operation);- Returns, in FORTRAN syntax, "x ** n" where n>=0. In the +
Returns, in FORTRAN syntax, "x ** n" where n>=0. In the case of n == 0, returns the identity element for the monoid operation. The two-argument signature uses multiplication (for a true "power" implementation), but addition is supported as well. @@ -215,9 +221,9 @@ libstdc++-v3 Coolest Name. It "assigns sequentially increasing values to a range. That is, it assigns value to *first, value + 1 to *(first + 1) and so on." Quoted from SGI documentation. +
void iota(_ForwardIter first, _ForwardIter last, _Tp value);-
Return to the main extensions page or to the homepage.
@@ -225,7 +231,7 @@ libstdc++-v3 -
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html
index b795c652f60..7494334a7eb 100644
--- a/libstdc++-v3/docs/html/faq/index.html
+++ b/libstdc++-v3/docs/html/faq/index.html
@@ -1,10 +1,10 @@
-
-
-
+
+
+
+
Questions
-
-
+
-
+
+ _XOPEN_SOURCE
/
_GNU_SOURCE
/ etc is always defined
-
-
+
-
-
+
+
@@ -127,7 +135,7 @@
official design document.
The completion of the ISO C++ standardization gave the C++ community a powerful set of reuseable tools in the form @@ -153,7 +161,7 @@ nor be worried about platform-specific incompatibilities.
-The libstdc++ project is contributed to by several developers all over the world, in the same way as GCC or Linux. @@ -168,7 +176,7 @@ If you have questions, ideas, code, or are just curious, sign up!
-The fourteenth (and latest) snapshot of libstdc++-v3 is available @@ -183,9 +191,9 @@ of the SGI STL.
-Here is a page devoted to this topic. Subscribing to the mailing @@ -205,7 +213,7 @@ which is no longer available, thanks deja...--> we all thought was working, is more than welcome!
-The most recent libg++ README states that libg++ is no longer being actively maintained. It should not be used for new @@ -244,7 +252,7 @@ which is no longer available, thanks deja...--> describes where to find the last libg++ source.
-If you have read the README and RELEASE-NOTES files, and your question remains unanswered, then just ask the mailing list. @@ -260,13 +268,13 @@ which is no longer available, thanks deja...--> or Gabriel Dos Reis.
-See our license description for these and related questions.
-Complete instructions are not given here (this is a FAQ, not @@ -277,9 +285,12 @@ which is no longer available, thanks deja...--> easier and more automated than building the GCC 2.[78] series was. If you are using GCC 2.95, you can still build earlier snapshots of libstdc++. +
The file documentation.html provides a good overview of the steps necessary to build, install, @@ -295,18 +306,18 @@ which is no longer available, thanks deja...--> ".../docs/17_intro/" directory of the distribution.
-This question has become moot and has been removed. The stub is here to preserve numbering (and hence links/bookmarks).
-The Concurrent Versions System 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 CVS entry in the GNU software catalogue has a better description as well as a @@ -321,7 +332,7 @@ which is no longer available, thanks deja...-->
-libstdc++-v3 comes with its own testsuite. You do not need
to actually install the library ("make
@@ -337,7 +348,7 @@ which is no longer available, thanks deja...-->
please write up your idea and send it to the list!
Usually the size of libraries on disk isn't noticeable. When a link editor (or simply "linker") pulls things from a @@ -387,7 +398,7 @@ which is no longer available, thanks deja...--> when building the library.
-This question has become moot and has been removed. The stub is here to preserve numbering (and hence links/bookmarks).
-This question has become moot and has been removed. The stub is here to preserve numbering (and hence links/bookmarks).
-By default we try to support the C99 long long
type.
This requires that certain functions from your C library be present.
@@ -433,7 +444,7 @@ which is no longer available, thanks deja...-->
This has been fixed for 3.0.3 and onwards.
-_XOPEN_SOURCE
/ _GNU_SOURCE
/ etc is always definedOn Solaris, g++ (but not gcc) always defines the preprocessor @@ -465,13 +476,13 @@ which is no longer available, thanks deja...--> a list of predefined macros for any particular installation.
This has been discussed on the mailing lists - quite a bit. + quite a bit.
This method is something of a wart. We'd like to find a cleaner solution, but nobody yet has contributed the time.
-This is a long-standing bug in the OS X support. Fortunately, the patch is quite simple, and well-known. @@ -479,7 +490,7 @@ which is no longer available, thanks deja...--> link to the solution.
-This is by no means meant to be complete nor exhaustive, but mentions some problems that users may encounter when building @@ -596,7 +607,7 @@ New: experiences. :-) -
Yes, unfortunately, there are some. In a message @@ -615,28 +626,26 @@ New: Some of these have resulted in code changes.
-There are things which are not bugs in the compiler (4.2) nor the language specification (4.3), but aren't really bugs in libstdc++, either. Really! Please do not report these as bugs.
- --Weffc++
- The biggest of these is the quadzillions of warnings about the
- library headers emitted when -Weffc++
is used. Making
- libstdc++ "-Weffc++-clean" is not a goal of the project,
- for a few reasons. Mainly, that option tries to enforce
- object-oriented programming, while the Standard Library isn't
- necessarily trying to be OO.
-
reopening a stream fails - Did I just say that -Weffc++ was our biggest false-bug report? I - lied. (It used to be.) Today it seems to be reports that after - executing a sequence like -
+- --Weffc++ + The biggest of these is the quadzillions of warnings about the + library headers emitted when
+-Weffc++
is used. Making + libstdc++ "-Weffc++-clean" is not a goal of the project, + for a few reasons. Mainly, that option tries to enforce + object-oriented programming, while the Standard Library isn't + necessarily trying to be OO. +reopening a stream fails + Did I just say that -Weffc++ was our biggest false-bug report? + I lied. (It used to be.) Today it seems to be reports that after + executing a sequence like +
+#include <fstream> ... std::fstream fs("a_file"); @@ -645,59 +654,54 @@ New: // . fs.close(); fs.open("a_new_file");- all operations on the re-openedfs
will fail, or at - least act very strangely. Yes, they often will, especially if -fs
reached the EOF state on the previous file. The - reason is that the state flags are not cleared - on a successful call to open(). The standard unfortunately did - not specify behavior in this case, and to everybody's great sorrow, - the proposed LWG resolution (see - DR #22) is to leave the flags unchanged. You must insert a call - tofs.clear()
between the calls to close() and open(), - and then everything will work like we all expect it to work. - -
rel_ops
- Another is the rel_ops
namespace and the template
- comparison operator functions contained therein. If they become
- visible in the same namespace as other comparison functions
- (e.g., 'using
' them and the <iterator> header),
- then you will suddenly be faced with huge numbers of ambiguity
- errors. This was discussed on the -v3 list; Nathan Myers
- sums
- things up here. The collisions with vector/string iterator
- types have been fixed for 3.1.
-
If you have found an extremely broken header file which is - causing problems for you, look carefully before submitting a - "high" priority bug report (which you probably shouldn't - do anyhow; see the last paragraph of the page describing +
all operations on the re-opened fs
will fail, or at
+ least act very strangely. Yes, they often will, especially if
+ fs
reached the EOF state on the previous file. The
+ reason is that the state flags are not cleared
+ on a successful call to open(). The standard unfortunately did
+ not specify behavior in this case, and to everybody's great sorrow,
+ the proposed LWG resolution (see
+ DR #22) is to leave the flags unchanged. You must insert a call
+ to fs.clear()
between the calls to close() and open(),
+ and then everything will work like we all expect it to work.
+
rel_ops
+ Another is the rel_ops
namespace and the template
+ comparison operator functions contained therein. If they become
+ visible in the same namespace as other comparison functions
+ (e.g., 'using
' them and the <iterator> header),
+ then you will suddenly be faced with huge numbers of ambiguity
+ errors. This was discussed on the -v3 list; Nathan Myers
+ sums
+ things up here. The collisions with vector/string iterator
+ types have been fixed for 3.1.
+
If you have found an extremely broken header file which is + causing problems for you, look carefully before submitting a + "high" priority bug report (which you probably shouldn't + do anyhow; see the last paragraph of the page describing the GCC bug database). -
-If the headers are in ${prefix}/include/g++-3
, or if
- the installed library's name looks like libstdc++-2.10.a
- or libstdc++-libc6-2.10.so
,
- then you are using the old libstdc++-v2 library, which is nonstandard
- and unmaintained. Do not report problems with -v2 to the -v3
- mailing list.
-
Currently our header files are installed in
- ${prefix}/include/g++-v3
(see the 'v'?). This may
- change with the next release of GCC, as it may be too confusing,
- but the
- question has not yet been decided.
-
glibc - 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: -
+ +- -If the headers are in
+${prefix}/include/g++-3
, or if + the installed library's name looks likelibstdc++-2.10.a
+ orlibstdc++-libc6-2.10.so
, + then you are using the old libstdc++-v2 library, which is nonstandard + and unmaintained. Do not report problems with -v2 to the -v3 + mailing list. +Currently our header files are installed in +
+${prefix}/include/g++-v3
(see the 'v'?). This may + change with the next release of GCC, as it may be too confusing, + but the + question has not yet been decided. +glibc + 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: +
+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 @@ -705,34 +709,31 @@ 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- Note that 2.95.x shipped with the - old v2 library which is no longer - maintained. Also note that gcc 2.95.3 fixes this problem, but - requires a separate patch for libstdc++-v3. - -
concept checks
- If you see compilation errors containing messages about
- fooConcept
and a constraints
- member function, then most likely you have violated one of the
- requirements for types used during instantiation of template
- containers and functions. For example, EqualityComparableConcept
- appears if your types must be comparable with == and you have not
- provided this capability (a typo, or wrong visibility, or you
- just plain forgot, etc).
-
More information, including how to optionally enable/disable the - checks, is available - here. -
- - -dlopen/dlsym - If you are using the C++ library across dynamically-loaded - objects, make certain that you are passing the correct options - when compiling and linking: -
++ g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl -Note that 2.95.x shipped with the + old v2 library which is no longer + maintained. Also note that gcc 2.95.3 fixes this problem, but + requires a separate patch for libstdc++-v3. +
+concept checks + If you see compilation errors containing messages about +
+fooConcept
and aconstraints
+ member function, then most likely you have violated one of the + requirements for types used during instantiation of template + containers and functions. For example, EqualityComparableConcept + appears if your types must be comparable with == and you have not + provided this capability (a typo, or wrong visibility, or you + just plain forgot, etc). +More information, including how to optionally enable/disable the + checks, is available + here. +
+dlopen/dlsym + If you are using the C++ library across dynamically-loaded + objects, make certain that you are passing the correct options + when compiling and linking: +
+// compile the library components g++ -fPIC -c a.cc g++ -fPIC -c b.cc @@ -743,10 +744,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff g++ -fPIC -shared -rdynamic -o libfoo.so a.o b.o ... z.o // link the executable - g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl-
If you have found a bug in the library and you think you have a working fix, then send it in! The main GCC site has a page @@ -765,7 +765,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff testsuite -- but only if such a test exists.
-Hopefully, not much. The goal of libstdc++-v3 is to produce a fully-compliant, fully-portable Standard Library. After that, @@ -802,16 +802,16 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff we add code to the library based on what the current proposed resolution specifies. Those additions are listed in the extensions page. -
+Performance tuning. Lots of performance tuning. This too is already underway for post-3.0 releases, starting with memory expansion in container classes and buffer usage in synchronized stream objects. -
+An ABI for libstdc++ is being developed, so that multiple binary-incompatible copies of the library can be replaced with a single backwards-compatible library, like libgcc_s.so is. -
+The current libstdc++ contains extensions to the Library which must be explicitly requested by client code (for example, the hash tables from SGI). Other extensions may be added to @@ -819,7 +819,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff (For example, the "long long" type from C99.) Bugfixes and rewrites (to improve or fix thread safety, for instance) will of course be a continuing task. -
+This question about the next libstdc++ prompted some brief but @@ -827,7 +827,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff speculation.
-The STL from SGI, version 3.3, was the most recent merge of the STL codebase. The @@ -844,14 +844,15 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff recommended reading.
-Headers in the ext
and backward
subdirectories should be referred to by their relative paths:
-
+ +#include <ext/hash_map>- rather than using-I
or other options. This is more +rather than using
--I
or other options. This is more portable and forward-compatible. (The situation is the same as that of other headers whose directories are not searched directly, e.g.,<sys/stat.h>
,<X11/Xlib.h>
. @@ -860,13 +861,13 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff their own page.
+
5.5 [removed]
This question has become moot and has been removed. The stub is here to preserve numbering (and hence links/bookmarks).
-
+
5.6 Is libstdc++-v3 thread-safe?
When the system's libc is itself thread-safe, a non-generic implementation of atomicity.h exists for the architecture, and gcc @@ -877,7 +878,8 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff what object locks must be held based on the objects referenced in a method call. Without getting into great detail, here is an example which requires user-level locks: -
+ +library_class_a shared_object_a; thread_main () { @@ -887,18 +889,17 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff } // Multiple copies of thread_main() are started in independent threads.-Under the assumption that object_a and object_b are never exposed to another thread, here is an example that should not require any user-level locks: -
+ +thread_main () { library_class_a object_a; library_class_b *object_b = new library_class_b; object_a.add_b (object_b); object_a.mutate (); }-All library objects are safe to use in a multithreaded program as long as each thread carefully locks out access by any other thread while it uses any object visible to another thread. In general, @@ -913,7 +914,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff more information.
-
+
5.7 How do I get a copy of the ISO C++ Standard?
Copies of the full ISO 14882 standard are available on line via the ISO mirror site for committee members. Non-members, or those who @@ -931,7 +932,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff ISO homepage and find out!
-
+
5.8 What's an ABI and why is it so messy?
"ABI" stands for "Application Binary Interface." Conventionally, it refers to a great mass of details about how @@ -980,7 +981,7 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff -
+
See license.html for copying conditions. Comments and suggestions are welcome, and may be sent to diff --git a/libstdc++-v3/docs/html/faq/index.txt b/libstdc++-v3/docs/html/faq/index.txt index 30f32d3609f..59632af35d4 100644 --- a/libstdc++-v3/docs/html/faq/index.txt +++ b/libstdc++-v3/docs/html/faq/index.txt @@ -106,8 +106,8 @@ The libstdc++ project is contributed to by several developers all over the world, in the same way as GCC or Linux. Benjamin Kosnik, Gabriel - Dos Reis, Phil Edwards, Ulrich Drepper, Loren James Rittle, and - Paolo Carlini are the lead maintainers of the CVS archive. + Dos Reis, Phil Edwards, Ulrich Drepper, Loren James Rittle, and Paolo + Carlini are the lead maintainers of the CVS archive. Development and discussion is held on the libstdc++ mailing list. Subscribing to the list, or searching the list archives, is open to diff --git a/libstdc++-v3/docs/html/install.html b/libstdc++-v3/docs/html/install.html index 6c2f6668d92..7c631086c27 100644 --- a/libstdc++-v3/docs/html/install.html +++ b/libstdc++-v3/docs/html/install.html @@ -1,12 +1,11 @@ - - - - - + + + +
libstdc++-v3 Installation Instructions - + @@ -18,21 +17,22 @@To the libstdc++-v3 homepage. +
-
+
Contents
Finally, a few system-specific requirements:
-Finally, a few system-specific requirements:
+The following definitions will be used throughout the rest of this @@ -131,15 +131,20 @@
Note:
Check out or download the GCC sources: the resulting source directory @@ -175,7 +182,7 @@ mv libsrcdir libstdc++-v3 -
If you have never done this before, you should read the basic
GCC Installation
@@ -196,7 +203,7 @@
gccsrcdir/configure --prefix=destdir --other-opts...
- Now you have a few options: Installation will create the destdir directory and
populate it with subdirectories:
@@ -266,7 +273,7 @@
If you only built a static library (libstdc++.a), or if you
@@ -279,23 +286,25 @@
the usual ones are printed to the screen during installation.
They include:
Use the
See license.html for copying conditions.
Comments and suggestions are welcome, and may be sent to
diff --git a/libstdc++-v3/docs/html/makedoc.awk b/libstdc++-v3/docs/html/makedoc.awk
index 5d1bfc7a710..9da77d9c1a1 100644
--- a/libstdc++-v3/docs/html/makedoc.awk
+++ b/libstdc++-v3/docs/html/makedoc.awk
@@ -9,7 +9,7 @@
BEGIN {
state = "looking";
entries = 0;
- printf ("
+
Building and installing the library
[re]building everything
@@ -236,7 +243,7 @@
make install-target-libstdc++-v3
-
+
Post-installation
+
Using the library
Find the new library at runtime (shared linking only)
+
+
+
-
- -Wl,--rpath,destdir/lib
- -Wl,-rpath,destdir/lib
- -Wl,-Rdestdir/lib
- -Wl,--rpath,destdir/lib
-Wl,-rpath,destdir/lib
-Wl,-Rdestdir/lib
ldd(1)
utility to show which library the system
thinks it will get at runtime.
+
\n");
}
@@ -39,7 +39,7 @@ state == "entries" && /^<\/ul>/ {
END {
for (i = 0; i < entries; i++)
printf (" %s\n", entry[i]);
- printf ("
\n\n");
+ printf (" \n