From c3d8729e5fd7bb66c398fd2512211e49f7ececbc Mon Sep 17 00:00:00 2001
From: bkoz
The latest version of this document is always available at
- http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/abi.html.
+ http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/api.html.
@@ -30,565 +30,260 @@
2.72 The first generation GNU C++ library was called libg++. It had a
-working relationship with at least two kinds of dinosaur. Sadly, the
-details were not pried away from the estate.
+ A list of user-visible changes, by release version.
+
+Extensions moved to Known Issues include many of the limitations of its immediate ancestor. At least some older implementations don't have
+Include files from the SGI/HP sources that pre-date the ISO standard
+are added. These files are placed into
+the
- In earlier versions of the standard,
- <fstream.h>,
- <ostream.h>
- and <istream.h>
- used to define
- Some include adjustment may be required. Deprecated include <backward/strstream> added. Removal of include <builtinbuf.h>, <indstream.h>, <parsestream.h>, <PlotFile.h>, <SFile.h>, <stdiostream.h>, and <stream.h>. This project is no longer maintained or supported, and the sources
-archived. The code is considered replaced and rewritten.
- The second generation GNU C++ library was called libstdc++, or
-libstdc++-v2. It was a separate GNU project, although reliably paired
-with GCC. It spans the time between libg++ and pre-ISO C++.
- egcs 1.x 2.95 2.96 Portability Notes Implementation Limitations
- Some care is required to support C++ compiler and or library
- implementation that do not have the standard library in
-
- The following sections list some possible solutions to support compilers
- that cannot ignore First, see if the compiler has a flag for this. Namespace
- back-portability-issues are generally not a problem for g++
- compilers that do not have libstdc++ in Second, experiment with a variety of pre-processor tricks. By defining Define a macro
-
- The following illustrate implementation-allowed illegal iterator
- use, and then correct use. you cannot do
- you cannot clear an iterator's reference
- (
-
+Extensions to Glibc 2.0.x and 2.1.x define <ctype.h>
-functionality as macros (isspace, isalpha etc.).
+
+Extensions to tree data structures added in <ext/rb_tree>.
-This implementations of libstdc++, however, keep these functions as
-macros, and so it is not back-portable to use fully qualified
-names. For example:
+Removal of <ext/tree>, moved to <backward/tree.h>.
Results in something like this:
- Symbol versioning introduced for shared library. Removal of include <backward/strstream.h>. Allocator changes. Change A solution is to modify a header-file so that the compiler tells
-<ctype.h> to define functions instead of macros:
- Error handling in iostreams cleaned up, made consistent. Then, include <ctype.h>
+
+Large file support.
-Another problem arises if you put a Extensions for generic characters and
+Support for
- One solution is to add an autoconf-test for this:
-
-If you are using other (non-GNU) compilers it might be a good idea
-to check for
-Use some kind of autoconf test, plus this:
-
- There are two functions for deleting the contents of a string:
- These are no longer supported. Please use
-
- stringstreams instead.
-
- Libstdc++ provides the new
- with
- You can then use output-stringstreams like this:
-
- Input-stringstreams can be used similarly:
- One (the only?) restriction is that an istrstream cannot be re-filled:
-
-If you don't care about speed, you can put these conversions in
- a template-function:
- Another example of using stringstreams is in this howto.
+Macro guard for libstdc++ changed, from _GLIBCPP_ to _GLIBCXX_.
There is additional information in the libstdc++-v2 info files, in
-particular "info iostream".
+
+Extension <ext/stdio_sync_filebuf.h> added.
This project is no longer maintained or supported, and the sources
-archived. The code is considered replaced and rewritten.
+
+Extension <ext/demangle.h> added.
The third generation GNU C++ library is called libstdc++, or
-libstdc++-v3.
+
+TR1 features first appear.
The subset commonly known as the Standard Template Library
- (chapters 23 through 25, mostly) is adapted from the final release
- of the SGI STL, with extensive changes.
- A more formal description of the V3 goals can be found in the
- official design document.
- Portability Notes The pre-ISO C++ headers (iostream.h etc.) are available, but inclusion
- generates a warning that you are using deprecated headers.
+
+Extension allocator <ext/array_allocator.h> added.
This compatibility layer is constructed by including the
- standard C++ headers, and injecting any items in
- For those of you new to ISO C++ (welcome, time travelers!), no,
- that isn't a typo. Yes, the headers really have new names.
- Marshall Cline's C++ FAQ Lite has a good explanation in item
- [27.4].
- Some include adjustment may be required.
+Extension Header files
+Removal of <ext/demangle.h>.
The existence of
+Removal of <cassert> from all standard headers: now has to be explicitly included for For output streams, "nocreate" is probably the default,
-unless you specify Extensions for policy-based data structures first added. New includes,
+types, namespace
- Phil Edwards writes: It was considered and rejected for the ISO
- standard. Not all environments use file descriptors. Of those
- that do, not all of them use integers to represent them.
-
- For a portable solution (among systems which use
- filedescriptors), you need to implement a subclass of
-
- An extension is available that implements this.
-
- For another example of this, refer to
- fdstream example
- by Nicolai Josuttis.
+ Extensions for typelists added in <ext/typelist.h>.
API History, User Visible Changes Extension for policy-based 3.0.0 Default visibility attributes applied to 3.1.0 3.2.0 3.3.0 TR1 <random>, <complex>, and C compatibility headers added. Extensions for concurrent programming consolidated
+into <ext/concurrence.h> and <ext/atomicity.h>,
+including change of namespace to 3.4.0 Extensions for type traits consolidated
+into <ext/type_traits.h>. Additional traits are added
+( Extensions for policy-based data structures revised. New includes,
+types, namespace moved to 4.0.0 4.1.0 Extensions for debug mode modified: now nested in Extensions added: <ext/typelist.h>
+and <ext/throw_allocator.h>.
+ 4.2.0 4.3.0
+C++0X features first appear.
+ TR1 <regex> and <cmath>'s mathematical special function added.
Backward include edit.
+
+Header dependency streamlining.
+
+Debug mode for <unordered_map> and <unordered_set>.
+
+Parallel mode first appears.
+ Variadic template implementations of items in <tuple> and
+ <functional>.
+
-Migrating to gcc-4.1, by Dan Kegel.
+ Default
-Building the whole Debian archive with GCC 4.1: a summary, by Martin Michlmayr
+PCH binary files no longer installed. Instead, the source files are installed.
-Migration guide for GCC-3.2
+Namespace pb_ds moved to __gnu_pb_ds.
+ The latest version of this document is always available at
+
+ http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/backwards_compatibility.html.
+
+ To the libstdc++ homepage.
+ The first generation GNU C++ library was called libg++. It was a
+separate GNU project, although reliably paired with GCC. Rumors imply
+that it had a working relationship with at least two kinds of
+dinosaur.
+ Known Issues include many of the limitations of its immediate ancestor. Portability notes and known implementation limitations are as follows. At least some older implementations don't have
+ In earlier versions of the standard,
+ <fstream.h>,
+ <ostream.h>
+ and <istream.h>
+ used to define
+ Some include adjustment may be required. This project is no longer maintained or supported, and the sources
+archived. The code is considered replaced and rewritten.
+ The second generation GNU C++ library was called libstdc++, or
+libstdc++-v2. It spans the time between libg++ and pre-ISO C++
+standardization and is usually associated with the following GCC
+releases: egcs 1.x, gcc 2.95, and gcc 2.96.
+ The STL portions of this library are based on SGI/HP STL release 3.11.
+ Portability notes and known implementation limitations are as follows.
+ Some care is required to support C++ compiler and or library
+ implementation that do not have the standard library in
+
+ The following sections list some possible solutions to support compilers
+ that cannot ignore First, see if the compiler has a flag for this. Namespace
+ back-portability-issues are generally not a problem for g++
+ compilers that do not have libstdc++ in Second, experiment with a variety of pre-processor tricks. By defining Another pre-processor based approach is to define a
+macro
+ The following illustrate implementation-allowed illegal iterator
+ use, and then correct use.
+ you cannot do
+ you cannot clear an iterator's reference
+ (
+ Glibc 2.0.x and 2.1.x define <ctype.h>
+functionality as macros (isspace, isalpha etc.).
+
+This implementations of libstdc++, however, keep these functions as
+macros, and so it is not back-portable to use fully qualified
+names. For example:
+ Results in something like this:
+ A solution is to modify a header-file so that the compiler tells
+<ctype.h> to define functions instead of macros:
+ Then, include <ctype.h>
+
+Another problem arises if you put a
+ One solution is to add an autoconf-test for this:
+
+If you are using other (non-GNU) compilers it might be a good idea
+to check for
+Use some kind of autoconf test, plus this:
+
+ There are two functions for deleting the contents of a string:
+
+ Unfortunately, ut These are no longer supported. Please use
+
+ stringstreams instead.
+
+Although the ISO standard
+ with
+ You can then use output-stringstreams like this:
+
+ Input-stringstreams can be used similarly:
+ One (the only?) restriction is that an istrstream cannot be re-filled:
+
+If you don't care about speed, you can put these conversions in
+ a template-function:
+ Another example of using stringstreams is in this howto.
+ There is additional information in the libstdc++-v2 info files, in
+particular "info iostream".
+ This project is no longer maintained or supported, and the sources
+archived. The code is considered replaced and rewritten.
+ The third generation GNU C++ library is called libstdc++, or
+libstdc++-v3.
+ The subset commonly known as the Standard Template Library
+ (chapters 23 through 25, mostly) is adapted from the final release
+ of the SGI STL (version 3.3), with extensive changes.
+ A more formal description of the V3 goals can be found in the
+ official design document.
+ Portability notes and known implementation limitations are as follows. The pre-ISO C++ headers
+ ( This compatibility layer is constructed by including the
+ standard C++ headers, and injecting any items in
+ For those of you new to ISO C++ (welcome, time travelers!), no,
+ that isn't a typo. Yes, the headers really have new names.
+ Marshall Cline's C++ FAQ Lite has a good explanation in item
+ [27.4].
+ Some include adjustment may be required. What follows is an
+autoconf test that defines Porting between pre-ISO headers and ISO headers is simple: headers
+like <vector.h> can be replaced with <vector> and a using
+directive Header files The following autoconf tests check for working HP/SGI hash containers.
+ The existence of For output streams, "nocreate" is probably the default,
+unless you specify
+ Phil Edwards writes: It was considered and rejected for the ISO
+ standard. Not all environments use file descriptors. Of those
+ that do, not all of them use integers to represent them.
+
+ For a portable solution (among systems which use
+ filedescriptors), you need to implement a subclass of
+
+ An extension is available that implements this.
+
+ For another example of this, refer to
+ fdstream example
+ by Nicolai Josuttis.
+ Check for complete library coverage of the C++1998/2003 standard.
+ Check for library coverage of the TR1 standard.
+ An alternative is to check just for specific TR1 includes, such as <unordered_map> and <unordered_set>.
+ Check for baseline language coverage in the compiler for the C++0xstandard.
+ Check for library coverage of the C++0xstandard.
+ As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For <unordered_map>
+
+Migrating to gcc-4.1, by Dan Kegel.
+
+Building the whole Debian archive with GCC 4.1: a summary, by Martin Michlmayr
+
+Migration guide for GCC-3.2
+ The C++ standard specifies 50 header files that must be
+ The C++ standard specifies the entire set of header files that must be
available to all hosted implementations. Actually, the word
"files" is a misnomer, since the contents of the headers
don't necessarily have to be in any kind of external file. The
- only rule is that when one C++98/03 include files:
+ That said, in practice files are used. There are two main types of include files: header files related to
+a specific version of the ISO C++ standard (called Standard Headers),
+and all others (TR1, C++ ABI, and Extensions). Two dialects of standard headers are supported, corresponding to
+the 1998 standard as updated for 2003, and the draft of the upcoming
+200x standard.
+ C++98/03 include files. These are available in the default compilation mode, ie C++0x include files:
+ C++0x include files. These are only available in C++0x compilation mode, ie In addition, TR1 includes as:
+ Also included are files for the C++ ABI interface:
+ And a large variety of extensions.
+ A few simple rules.
+ First, mixing different dialects of the standard headers is not
+possible. It's an all-or-nothing affair. Thus, code like
+ In addition, TR1 includes as:
+ Implies C++0x mode. To use the entities in <array>, the C++0x
+compilation mode must be used, which implies the C++0x functionality
+(and deprecations) in <functional> will be present.
+ Second, the other headers can be included with either dialect of
+the standard headers, although features and types specific to C++0x
+are still only enabled when in C++0x compilation mode. So, to use
+rvalue references with A special case of the second rule is the mixing of TR1 and C++0x
+facilities. It is possible (although not especially prudent) to
+include both the TR1 version and the C++0x version of header in the
+same translation unit:
+ Several parts of C++0x diverge quite substantially from TR1 predecessors.
+
- You should not use the C-headers (except for system-level
- headers) from C++ programs. Instead, you should use a set of
- headers that are named by prepending 'c' and, as usual,
- omitting the extension (.h). For example, instead of using
- <math.h>, you
- should use <cmath>. In some cases this has
- the advantage that the C++-header is more standardized than
- the C-header (i.e. <ctime> (almost)
- corresponds to either <time.h> or <sys/time.h>).
-
- The standard specifies that if you include the C-style header
- (<math.h> in
- this case), the symbols will be available both in the global
- namespace and in namespace FIXME: this is no longer accurate.
- For more information on this, and for information on how the
- GNU C++ implementation might reuse ("shadow") the C
- library-functions, have a look at
- www.cantrip.org.
- There are three base header files that are provided. They can be
+used to precompile the standard headers and extensions into binary
+files that may the be used to speed compiles that use these headers.
+ Includes all standard headers. Actual content varies depending on
+language dialect.
+ Includes all of <stdc++.h>, and adds all the TR1 headers.
+ Includes all of <stdtr1c++.h>, and adds all the Extension headers.
+ How to construct a .gch file from one of these base header files. First, find the include directory for the compiler. One way to do
+this is: Then, create a precompiled header file with the same flags that
+will be used to compile other projects. The resulting file will be quite large: the current size is around
+thirty megabytes. How to use the resulting file. Verification that the PCH file is being used is easy: The exclamation point to the left of the Detailed information about creating precompiled header files can be found in the GCC documentation.
+ There are three main namespaces.
+ The ISO C++ standards specify that "all library entities are defined
+within namespace std." This includes namepaces nested
+within Specified by the C++ ABI. This ABI specifies a number of type and
+function APIs supplemental to those required by the ISO C++ Standard,
+but necessary for interoperability.
+ Indicating one of several GNU extensions. Choices
+include A complete list of implementation namespaces (including namespace contents) is available in the generated source documentation.
+
One standard requirement is that the library components are defined
@@ -167,37 +353,46 @@ should not be used in a global context, like header files.
qualified name for each library symbol
(i.e.
- Gtk-- defines
- most of its classes in namespace Gtk::. Thus, it was possible to
- adapt Gtk-- to namespace std:: by using a C++-feature called
+Best practice in programming suggests sequestering new data or
+functionality in a sanely-named, unique namespace whenever
+possible. This is considered an advantage over dumping everything in
+the global namespace, as then name look-up can be explicitly enabled or
+disabled as above, symbols are consistently mangled without repetitive
+naming prefixes or macros, etc.
+ For instance, consider a project that defines most of its classes in
In this example, All pre-processor switches and configurations are all gathered
+ in the file All library macros begin with Below is the macro which users may check for library version
+ information. Below are the macros which users may change with #define/#undef or
+ with -D/-U compiler flags. 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 library build and configure time
+ (documented here), with the
+ various --enable/--disable choices being translated to
+ #define/#undef).
+ "ABI" means that changing from the default value may
+ mean changing the ABI of compiled code. In other words, these
+ choices control code which has already been compiled (i.e., in a
+ binary such as libstdc++.a/.so). If you explicitly #define or
+ #undef these macros, the headers may see different code
+ paths, but the libraries which you link against will not.
+ Experimenting with different values with the expectation of
+ consistent linkage requires changing the config headers before
+ building/installing the library.
+ This section discusses issues surrounding the proper compilation
of multithreaded applications which use the Standard C++
library. This information is GCC-specific since the C++
@@ -419,107 +710,11 @@ cases where the qualified verbage becomes unweidly.)
to the FAQ.
All pre-processor switches and configurations are all gathered
- in the file All library macros begin with Below is the macro which users may check for library version
- information. Below are the macros which users may change with #define/#undef or
- with -D/-U compiler flags. 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 library build and configure time
- (documented here), with the
- various --enable/--disable choices being translated to
- #define/#undef).
- "ABI" means that changing from the default value may
- mean changing the ABI of compiled code. In other words, these
- choices control code which has already been compiled (i.e., in a
- binary such as libstdc++.a/.so). If you explicitly #define or
- #undef these macros, the headers may see different code
- paths, but the libraries which you link against will not.
- Experimenting with different values with the expectation of
- consistent linkage requires changing the config headers before
- building/installing the library.
- Return to top of page or
to the FAQ.
- First.
+ API Evolution, Deprecation, and History of User Visible Changes
-
+ 3.0
+
+include/ext
.
No
-
-ios_base
std::ios_base
, so you should use std::ios::badbit
, std::ios::failbit
and std::ios::eofbit
and std::ios::goodbit
.
+include/backward
directory and a deprecated warning
+is added that notifies on inclusion (-Wno-deprecated
+deactivates the warning.)
No
-
-cout
in ostream.h
, no cin
in istream.h
cout
, cin
and so on. ISO C++ specifies that one needs to include
- <iostream>
- explicitly to get the required definitions.
-
- Second.
+ 3.1
-Namespace
-
-std::
not supported.namespace std
.
- std::
-qualified names.
- std::
, as
- the compilers use -fno-honor-std
(ignore
- std::
, :: = std::
) by default. That
- is, the responsibility for enabling or disabling
- std::
is on the user; the maintainer does not have
- to care about it. This probably applies to some other compilers
- as well.
- std
as a macro, fully-qualified namespace calls become global. Volia.
-
-
-#ifdef WICKEDLY_OLD_COMPILER
-# define std
-#endif
-
-(thanks to Juergen Heinzl who posted this solution on gnu.gcc.help)
-
-NAMESPACE_STD
, which is defined to
-either "" or "std" based on a compile-type
-test. On GNU systems, this can be done with autotools by means of an
-autoconf test (see below) for HAVE_NAMESPACE_STD
, then
-using that to set a value for the NAMESPACE_STD
macro.
-At that point, one is able to use NAMESPACE_STD::string
,
-which will evaluate to std::string
or
-::string
(ie, in the global namespace on systems that do
-not put string
in std::
).
-dnl @synopsis AC_CXX_HAVE_STD_NAMESPACE
-dnl
-dnl If the compiler supports the std namespace, define
-dnl HAVE_STD_NAMESPACE.
-dnl
-dnl @category Cxx
-dnl @author Todd Veldhuizen
-dnl @author Luc Maisonobe
-
-Illegal iterator usage.
+Extensions from SGI/HP moved from ostream::operator<<(iterator)
to print the
- address of the iterator => use operator<<
- &*iterator
instead ?
- iterator = 0
) => use
- iterator = iterator_type();
?
- if (iterator)
won't work any
- more => use if (iterator != iterator_type())
- ?namespace std
+to namespace __gnu_cxx
. As part of this, the following
+new includes are
+added: <ext/algorithm>, <ext/functional>, <ext/iterator>, <ext/memory>, and <ext/numeric>.
+
-
+isspace
from <cctype> is a macro
-basic_filebuf
introduced: __gnu_cxx::enc_filebuf
, and __gnu_cxx::stdio_filebuf
.
+
-#include <cctype>
-int main() { std::isspace('X'); }
-
-
+ 3.2
+
+
-std:: (__ctype_b[(int) ( ( 'X' ) )] & (unsigned short int) _ISspace ) ;
-
+
+ 3.3
+
+__malloc_alloc
to malloc_allocator
and __new_alloc
to new_allocator
.
-// This keeps isalnum, et al from being propagated as macros.
-#if __linux__
-# define __NO_CTYPE 1
-#endif
-
-
+ 3.4
+
+using namespace std;
-declaration at the top, and include <ctype.h>. This
-will result in ambiguities between the definitions in the global
-namespace (<ctype.h>) and the definitions in namespace
-std::
(<cctype>
).
+char_traits
added in <ext/pod_char_traits.h>.
No
+vector::at
, deque::at
, string::at
wchar_t
specializations of basic_filebuf
enhanced to support UTF-8
and Unicode
, depending on host. More hosts support basic wchar_t
functionality.
+
-AC_MSG_CHECKING(for container::at)
-AC_TRY_COMPILE(
-[
-#include <vector>
-#include <deque>
-#include <string>
-
-using namespace std;
-],
-[
-deque<int> test_deque(3);
-test_deque.at(2);
-vector<int> test_vector(2);
-test_vector.at(1);
-string test_string("test_string");
-test_string.at(3);
-],
-[AC_MSG_RESULT(yes)
-AC_DEFINE(HAVE_CONTAINER_AT)],
-[AC_MSG_RESULT(no)])
-
+Support for char_traits
beyond builtin types.
+
string::at
separately.
+Conformant allocator
class and usage in containers. As
+part of this, the following extensions are
+added: <ext/bitmap_allocator.h>, <ext/debug_allocator.h>, <ext/mt_allocator.h>, <ext/malloc_allocator.h>,<ext/new_allocator.h>, <ext/pool_allocator.h>.
No
std::char_traits<char>::eof
-#ifdef HAVE_CHAR_TRAITS
-#define CPP_EOF std::char_traits<char>::eof()
-#else
-#define CPP_EOF EOF
-#endif
-
-
-No
+Debug mode first appears.
+
string::clear
clear
and erase
(the latter
- returns the string).
-
- void
- clear() { _M_mutate(0, this->size(), 0); }
-
-
- basic_string&
- erase(size_type __pos = 0, size_type __n = npos)
- {
- return this->replace(_M_check(__pos), _M_fold(__pos, __n),
- _M_data(), _M_data());
- }
-
- Unfortunately, ut clear
is not
- implemented in this version, so you should use
- erase
(which is probably faster than
- operator=(charT*)
).
-
-
-Removal of
-
-ostream::form
and
-istream::scan
extensions.No
+PCH support.
+
basic_stringbuf
, basic_stringstream
i/ostringstream
-classes, (<sstream>), but for compatibility
- with older implementations you still have to use
- i/ostrstream
(<strstream>):
-
- #ifdef HAVE_SSTREAM
- #include <sstream>
- #else
- #include <strstream>
- #endif
-
-
-
strstream
is considered to be
- deprecated
- strstream
is limited to
- char
- ostringstream
you don't
- have to take care of terminating the string or freeing its
- memory
- istringstream
can be re-filled
- (clear(); str(input);)
-
- #ifdef HAVE_SSTREAM
- std::ostringstream oss;
- #else
- std::ostrstream oss;
- #endif
- oss << "Name=" << m_name << ", number=" << m_number << std::endl;
- ...
- #ifndef HAVE_SSTREAM
- oss << std::ends; // terminate the char*-string
- #endif
- // str() returns char* for ostrstream and a string for ostringstream
- // this also causes ostrstream to think that the buffer's memory
- // is yours
- m_label.set_text(oss.str());
- #ifndef HAVE_SSTREAM
- // let the ostrstream take care of freeing the memory
- oss.freeze(false);
- #endif
-
-
-std::string input;
-...
-#ifdef HAVE_SSTREAM
-std::istringstream iss(input);
-#else
-std::istrstream iss(input.c_str());
-#endif
-
-int i;
-iss >> i;
-
-
-
-std::istringstream iss(numerator);
-iss >> m_num;
-// this is not possible with istrstream
-iss.clear();
-iss.str(denominator);
-iss >> m_den;
-
-
-
-template <class X>
-void fromString(const string& input, X& any)
-{
-#ifdef HAVE_SSTREAM
-std::istringstream iss(input);
-#else
-std::istrstream iss(input.c_str());
-#endif
-X temp;
-iss >> temp;
-if (iss.fail())
-throw runtime_error(..)
-any = temp;
-}
-
-
-Little or no wide character support
-
-No templatized iostreams
-
-Thread safety issues.
-
-
- Third.
+ 4.0
-Pre-ISO headers moved to backwards
-std::
into the global namespace.
- Extension headers hash_map, hash_set moved to ext
+codecvt
specializations moved to <ext/codecvt_specializations.h>.
+hash_map
and hash_set
-moved to ext/hash_map
and ext/hash_set
,
-respectively. At the same time, all types in these files are enclosed
-in namespace __gnu_cxx
.
+
-No
+ios::nocreate/ios::noreplace
.
-
+ 4.1
+
-ios::nocreate
being used for
-input-streams has been confirmed, most probably because the author
-thought it would be more correct to specify nocreate explicitly. So
-it can be left out for input-streams.
+std::assert
calls.
std::ios::trunc
? To be safe, you can
-open the file for reading, check if it has been opened, and then
-decide whether you want to create/replace or not. To my knowledge,
-even older implementations support app
, ate
-and trunc
(except for app
?).
+pb_assoc
.
-No
-
-stream::attach(int fd)
.
-std::streambuf
(or
- std::basic_streambuf<..>
) which opens a file
- given a descriptor, and then pass an instance of this to the
- stream-constructor.
- <ext/stdio_filebuf.h>
contains a derived class called
- __gnu_cxx::stdio_filebuf
.
- This class can be constructed from a C FILE*
or a file
- descriptor, and provides the fd()
function.
-
-container iterator types are not necessarily container value_type*
-
-
-basic_string
first added: __gnu_cxx::__versa_string
in <ext/vstring.h>.
+
+ 4.2
+
+namespace std
. Support for -fvisibility
.
+__gnu_cxx
in some
+cases. Added types
+include _Lock_policy
, __concurrence_lock_error
, __concurrence_unlock_error
, __mutex
, __scoped_lock
.__conditional_type
, __enable_if
, others.)
+__pb_ds
.
+namespace
+std::__debug
and extensions in namespace
+__gnu_cxx::__debug
.std::assert
calls.
+
+ 4.3
+
-
+
-PCH files built but not installed.
-
-Namespace pb_ds moved to __gnu_pb_ds.
+
+
-
-
- Fourth, and future
-
+
-
- Deprecation and Backwards Compatibility
-
+
-
- Links
-
+what
implementations give more elaborate
+ exception strings for bad_cast
,
+ bad_typeid
, bad_exception
, and
+ bad_alloc
.
Backwards Compatibility
+
+
+
+ First.
+
+
+No
+
+ios_base
std::ios_base
, so you should use std::ios::badbit
, std::ios::failbit
and std::ios::eofbit
and std::ios::goodbit
.
+No
+
+cout
in ostream.h
, no cin
in istream.h
cout
, cin
and so on. ISO C++ specifies that one needs to include
+ <iostream>
+ explicitly to get the required definitions.
+
+
+ Second.
+
+Namespace
+
+std::
not supportednamespace std
.
+ std::
-qualified names.
+ std::
, as
+ the compilers use -fno-honor-std
(ignore
+ std::
, :: = std::
) by default. That
+ is, the responsibility for enabling or disabling
+ std::
is on the user; the maintainer does not have
+ to care about it. This probably applies to some other compilers
+ as well.
+ std
as a macro, fully-qualified namespace calls become global. Volia.
+#ifdef WICKEDLY_OLD_COMPILER
+# define std
+#endif
+
+(thanks to Juergen Heinzl who posted this solution on gnu.gcc.help)
+
+NAMESPACE_STD
, which is defined to either
+"" or "std" based on a compile-type test. On GNU
+systems, this can be done with autotools by means of an autoconf test
+(see below) for HAVE_NAMESPACE_STD
, then using that to
+set a value for the NAMESPACE_STD
macro. At that point,
+one is able to use NAMESPACE_STD::string
, which will
+evaluate to std::string
or
+::string
(ie, in the global namespace on systems that do
+not put string
in std::
).
+dnl @synopsis AC_CXX_NAMESPACE_STD
+dnl
+dnl If the compiler supports namespace std, define
+dnl HAVE_NAMESPACE_STD.
+dnl
+dnl @category Cxx
+dnl @author Todd Veldhuizen
+dnl @author Luc Maisonobe
+
+Illegal iterator usage
+
+
+ostream::operator<<(iterator)
to print the
+ address of the iterator => use operator<<
+ &*iterator
instead
+ iterator = 0
) => use
+ iterator = iterator_type();
+ if (iterator)
won't work any
+ more => use if (iterator != iterator_type())
+
+
+isspace
from <cctype> is a macro
+
+#include <cctype>
+int main() { std::isspace('X'); }
+
+
+
+std:: (__ctype_b[(int) ( ( 'X' ) )] & (unsigned short int) _ISspace ) ;
+
+
+
+
+// This keeps isalnum, et al from being propagated as macros.
+#if __linux__
+# define __NO_CTYPE 1
+#endif
+
+
+using namespace std;
+declaration at the top, and include <ctype.h>. This
+will result in ambiguities between the definitions in the global
+namespace (<ctype.h>) and the definitions in namespace
+std::
(<cctype>
).
+No
+
+vector::at
, deque::at
, string::at
+AC_MSG_CHECKING(for container::at)
+AC_TRY_COMPILE(
+[
+#include <vector>
+#include <deque>
+#include <string>
+
+using namespace std;
+],
+[
+deque<int> test_deque(3);
+test_deque.at(2);
+vector<int> test_vector(2);
+test_vector.at(1);
+string test_string("test_string");
+test_string.at(3);
+],
+[AC_MSG_RESULT(yes)
+AC_DEFINE(HAVE_CONTAINER_AT)],
+[AC_MSG_RESULT(no)])
+
+
+string::at
separately.
+No
+
+std::char_traits<char>::eof
+#ifdef HAVE_CHAR_TRAITS
+#define CPP_EOF std::char_traits<char>::eof()
+#else
+#define CPP_EOF EOF
+#endif
+
+
+No
+
+string::clear
clear
and erase
(the latter
+ returns the string).
+
+void
+clear() { _M_mutate(0, this->size(), 0); }
+
+
+basic_string&
+erase(size_type __pos = 0, size_type __n = npos)
+{
+ return this->replace(_M_check(__pos), _M_fold(__pos, __n),
+ _M_data(), _M_data());
+}
+
+
+clear
is not
+ implemented in this version, so you should use
+ erase
(which is probably faster than
+ operator=(charT*)
).
+Removal of
+
+ostream::form
and
+istream::scan
extensionsNo
+
+basic_stringbuf
, basic_stringstream
i/ostringstream
-classes are provided, (<sstream>), for compatibility with older implementations the pre-ISO i/ostrstream
(<strstream>) interface is also provided, with these caveats:
+
+
strstream
is considered to be
+ deprecated
+ strstream
is limited to
+ char
+ ostringstream
you don't
+ have to take care of terminating the string or freeing its
+ memory
+ istringstream
can be re-filled
+ (clear(); str(input);)
+
+#ifdef HAVE_SSTREAM
+# include <sstream>
+#else
+# include <strstream>
+#endif
+
+#ifdef HAVE_SSTREAM
+ std::ostringstream oss;
+#else
+ std::ostrstream oss;
+#endif
+
+oss << "Name=" << m_name << ", number=" << m_number << std::endl;
+...
+#ifndef HAVE_SSTREAM
+ oss << std::ends; // terminate the char*-string
+#endif
+
+// str() returns char* for ostrstream and a string for ostringstream
+// this also causes ostrstream to think that the buffer's memory
+// is yours
+m_label.set_text(oss.str());
+#ifndef HAVE_SSTREAM
+ // let the ostrstream take care of freeing the memory
+ oss.freeze(false);
+#endif
+
+
+
+std::string input;
+...
+#ifdef HAVE_SSTREAM
+std::istringstream iss(input);
+#else
+std::istrstream iss(input.c_str());
+#endif
+
+int i;
+iss >> i;
+
+
+
+std::istringstream iss(numerator);
+iss >> m_num;
+// this is not possible with istrstream
+iss.clear();
+iss.str(denominator);
+iss >> m_den;
+
+
+
+template <class X>
+void fromString(const string& input, X& any)
+{
+#ifdef HAVE_SSTREAM
+std::istringstream iss(input);
+#else
+std::istrstream iss(input.c_str());
+#endif
+X temp;
+iss >> temp;
+if (iss.fail())
+throw runtime_error(..)
+any = temp;
+}
+
+
+Little or no wide character support
+
+No templatized iostreams
+
+Thread safety issues
+
+
+
+ Third.
+
+Pre-ISO headers moved to backwards or removed
+
+iostream.h
, defalloc.h
etc.) are
+ available, unlike previous libstdc++ versions, but inclusion
+ generates a warning that you are using deprecated headers.
+std::
into the global namespace.
+ PRE_STDCXX_HEADERS
when they
+exist.
+# AC_HEADER_PRE_STDCXX
+AC_DEFUN([AC_HEADER_PRE_STDCXX], [
+ AC_CACHE_CHECK(for pre-ISO C++ include files,
+ ac_cv_cxx_pre_stdcxx,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -Wno-deprecated"
+
+ # Omit defalloc.h, as compilation with newer compilers is problematic.
+ AC_TRY_COMPILE([
+ #include <new.h>
+ #include <iterator.h>
+ #include <alloc.h>
+ #include <set.h>
+ #include <hashtable.h>
+ #include <hash_set.h>
+ #include <fstream.h>
+ #include <tempbuf.h>
+ #include <istream.h>
+ #include <bvector.h>
+ #include <stack.h>
+ #include <rope.h>
+ #include <complex.h>
+ #include <ostream.h>
+ #include <heap.h>
+ #include <iostream.h>
+ #include <function.h>
+ #include <multimap.h>
+ #include <pair.h>
+ #include <stream.h>
+ #include <iomanip.h>
+ #include <slist.h>
+ #include <tree.h>
+ #include <vector.h>
+ #include <deque.h>
+ #include <multiset.h>
+ #include <list.h>
+ #include <map.h>
+ #include <algobase.h>
+ #include <hash_map.h>
+ #include <algo.h>
+ #include <queue.h>
+ #include <streambuf.h>
+ ],,
+ ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_pre_stdcxx" = yes; then
+ AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
+ fi
+])
+
+
+using namespace std;
can be put at the global
+scope. This should be enough to get this code compiling, assuming the
+other usage is correct.
+Extension headers hash_map, hash_set moved to ext or backwards
+
+hash_map
and hash_set
moved
+to ext/hash_map
and ext/hash_set
,
+respectively. At the same time, all types in these files are enclosed
+in namespace __gnu_cxx
. Later versions move deprecate
+these files, and suggest using TR1's unordered_map
+and unordered_set
instead.
+
+# AC_HEADER_EXT_HASH_MAP
+AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
+ AC_CACHE_CHECK(for ext/hash_map,
+ ac_cv_cxx_ext_hash_map,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -Werror"
+ AC_TRY_COMPILE([#include
+
+
+# AC_HEADER_EXT_HASH_SET
+AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
+ AC_CACHE_CHECK(for ext/hash_set,
+ ac_cv_cxx_ext_hash_set,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -Werror"
+ AC_TRY_COMPILE([#include
+
+
+
+No
+
+ios::nocreate/ios::noreplace
.
+ios::nocreate
being used for
+input-streams has been confirmed, most probably because the author
+thought it would be more correct to specify nocreate explicitly. So
+it can be left out for input-streams.
+std::ios::trunc
? To be safe, you can
+open the file for reading, check if it has been opened, and then
+decide whether you want to create/replace or not. To my knowledge,
+even older implementations support app
, ate
+and trunc
(except for app
?).
+
+No
+
+stream::attach(int fd)
+std::streambuf
(or
+ std::basic_streambuf<..>
) which opens a file
+ given a descriptor, and then pass an instance of this to the
+ stream-constructor.
+ <ext/stdio_filebuf.h>
contains a derived class called
+ __gnu_cxx::stdio_filebuf
.
+ This class can be constructed from a C FILE*
or a file
+ descriptor, and provides the fd()
function.
+
+Support for C++98 dialect.
+
+
+
+
+# AC_HEADER_STDCXX_98
+AC_DEFUN([AC_HEADER_STDCXX_98], [
+ AC_CACHE_CHECK(for ISO C++ 98 include files,
+ ac_cv_cxx_stdcxx_98,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <cassert>
+ #include <cctype>
+ #include <cerrno>
+ #include <cfloat>
+ #include <ciso646>
+ #include <climits>
+ #include <clocale>
+ #include <cmath>
+ #include <csetjmp>
+ #include <csignal>
+ #include <cstdarg>
+ #include <cstddef>
+ #include <cstdio>
+ #include <cstdlib>
+ #include <cstring>
+ #include <ctime>
+
+ #include <algorithm>
+ #include <bitset>
+ #include <complex>
+ #include <deque>
+ #include <exception>
+ #include <fstream>
+ #include <functional>
+ #include <iomanip>
+ #include <ios>
+ #include <iosfwd>
+ #include <iostream>
+ #include <istream>
+ #include <iterator>
+ #include <limits>
+ #include <list>
+ #include <locale>
+ #include <map>
+ #include <memory>
+ #include <new>
+ #include <numeric>
+ #include <ostream>
+ #include <queue>
+ #include <set>
+ #include <sstream>
+ #include <stack>
+ #include <stdexcept>
+ #include <streambuf>
+ #include <string>
+ #include <typeinfo>
+ #include <utility>
+ #include <valarray>
+ #include <vector>
+ ],,
+ ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_stdcxx_98" = yes; then
+ AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
+ fi
+])
+
+
+
+
+Support for C++TR1 dialect.
+
+
+
+
+# AC_HEADER_STDCXX_TR1
+AC_DEFUN([AC_HEADER_STDCXX_TR1], [
+ AC_CACHE_CHECK(for ISO C++ TR1 include files,
+ ac_cv_cxx_stdcxx_tr1,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <tr1/array>
+ #include <tr1/ccomplex>
+ #include <tr1/cctype>
+ #include <tr1/cfenv>
+ #include <tr1/cfloat>
+ #include <tr1/cinttypes>
+ #include <tr1/climits>
+ #include <tr1/cmath>
+ #include <tr1/complex>
+ #include <tr1/cstdarg>
+ #include <tr1/cstdbool>
+ #include <tr1/cstdint>
+ #include <tr1/cstdio>
+ #include <tr1/cstdlib>
+ #include <tr1/ctgmath>
+ #include <tr1/ctime>
+ #include <tr1/cwchar>
+ #include <tr1/cwctype>
+ #include <tr1/functional>
+ #include <tr1/memory>
+ #include <tr1/random>
+ #include <tr1/regex>
+ #include <tr1/tuple>
+ #include <tr1/type_traits>
+ #include <tr1/unordered_set>
+ #include <tr1/unordered_map>
+ #include <tr1/utility>
+ ],,
+ ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
+ AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
+ fi
+])
+
+
+
+# AC_HEADER_TR1_UNORDERED_MAP
+AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
+ AC_CACHE_CHECK(for tr1/unordered_map,
+ ac_cv_cxx_tr1_unordered_map,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <tr1/unordered_map>], [using std::tr1::unordered_map;],
+ ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
+ AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
+ fi
+])
+
+
+
+# AC_HEADER_TR1_UNORDERED_SET
+AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
+ AC_CACHE_CHECK(for tr1/unordered_set,
+ ac_cv_cxx_tr1_unordered_set,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <tr1/unordered_set>], [using std::tr1::unordered_set;],
+ ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
+ AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
+ fi
+])
+
+
+
+
+
+Support for C++0x dialect.
+
+
+
+# AC_COMPILE_STDCXX_OX
+AC_DEFUN([AC_COMPILE_STDCXX_0X], [
+ AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
+ ac_cv_cxx_compile_cxx0x_native,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
+ AC_LANG_RESTORE
+ ])
+
+ AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
+ ac_cv_cxx_compile_cxx0x_cxx,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=c++0x"
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+
+ AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
+ ac_cv_cxx_compile_cxx0x_gxx,
+ [AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ AC_TRY_COMPILE([
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = c;],,
+ ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+
+ if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
+ test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
+ test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
+ AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
+ fi
+])
+
+
+
+
+
+# AC_HEADER_STDCXX_0X
+AC_DEFUN([AC_HEADER_STDCXX_0X], [
+ AC_CACHE_CHECK(for ISO C++ 0x include files,
+ ac_cv_cxx_stdcxx_0x,
+ [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+
+ AC_TRY_COMPILE([
+ #include <cassert>
+ #include <ccomplex>
+ #include <cctype>
+ #include <cerrno>
+ #include <cfenv>
+ #include <cfloat>
+ #include <cinttypes>
+ #include <ciso646>
+ #include <climits>
+ #include <clocale>
+ #include <cmath>
+ #include <csetjmp>
+ #include <csignal>
+ #include <cstdarg>
+ #include <cstdbool>
+ #include <cstddef>
+ #include <cstdint>
+ #include <cstdio>
+ #include <cstdlib>
+ #include <cstring>
+ #include <ctgmath>
+ #include <ctime>
+ #include <cwchar>
+ #include <cwctype>
+
+ #include <algorithm>
+ #include <array>
+ #include <bitset>
+ #include <complex>
+ #include <deque>
+ #include <exception>
+ #include <fstream>
+ #include <functional>
+ #include <iomanip>
+ #include <ios>
+ #include <iosfwd>
+ #include <iostream>
+ #include <istream>
+ #include <iterator>
+ #include <limits>
+ #include <list>
+ #include <locale>
+ #include <map>
+ #include <memory>
+ #include <new>
+ #include <numeric>
+ #include <ostream>
+ #include <queue>
+ #include <random>
+ #include <regex>
+ #include <set>
+ #include <sstream>
+ #include <stack>
+ #include <stdexcept>
+ #include <streambuf>
+ #include <string>
+ #include <tuple>
+ #include <typeinfo>
+ #include <type_traits>
+ #include <unordered_map>
+ #include <unordered_set>
+ #include <utility>
+ #include <valarray>
+ #include <vector>
+ ],,
+ ac_cv_cxx_stdcxx_0x=yes, ac_cv_cxx_stdcxx_0x=no)
+ AC_LANG_RESTORE
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ ])
+ if test "$ac_cv_cxx_stdcxx_0x" = yes; then
+ AC_DEFINE(STDCXX_0X_HEADERS,,[Define if ISO C++ 0x header files are present. ])
+ fi
+])
+
+
+
+
+# AC_HEADER_UNORDERED_MAP
+AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
+ AC_CACHE_CHECK(for unordered_map,
+ ac_cv_cxx_unordered_map,
+ [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ AC_TRY_COMPILE([#include <unordered_map>], [using std::unordered_map;],
+ ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_unordered_map" = yes; then
+ AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
+ fi
+])
+
+
+
+# AC_HEADER_UNORDERED_SET
+AC_DEFUN([AC_HEADER_UNORDERED_SET], [
+ AC_CACHE_CHECK(for unordered_set,
+ ac_cv_cxx_unordered_set,
+ [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ AC_TRY_COMPILE([#include <unordered_set>], [using std::unordered_set;],
+ ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+ ])
+ if test "$ac_cv_cxx_unordered_set" = yes; then
+ AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
+ fi
+])
+
+
+
+
+Container iterator_type is not necessarily container value_type*
+
+
+
+
+
+ Fourth, and future
+
+
+
+
+ Links
+
+
+
Contents
-
-Header Files
- Header Files
+ #include
's a certain header, the
- contents of that header, as defined by the Standard, become
+ only rule is that when one #include
's a header, the
+ contents of that header become
available, no matter how.
-std=c++98
or -std=gnu++98
.
-C++ Library Headers
-algorithm ios new stack
-bitset iosfwd numeric stdexcept
-complex iostream ostream streambuf
- istream queue string
-deque iterator
-exception limits typeinfo
-fstream list set
-functional locale map
-iomanip memory sstream
-
-C++ Headers for C Library Facilities
-cassert cfloat cmath cstddef
-ccomplex csetjmp cstdio ctime
-cctype ciso646 csignal
-cerrno climits cstdarg cstdlib cwchar
- clocale cstring cwctype
-
-
+<algorithm> <iomanip> <list> <ostream> <streambuf>
+<bitset> <ios> <locale> <queue> <string>
+<complex> <iosfwd> <map> <set> <typeinfo>
+<deque> <iostream> <memory> <sstream> <utility>
+<exception> <istream> <new> <stack> <valarray>
+<fstream> <iterator> <numeric> <stdexcept> <vector>
+<functional> <limits>
+<cassert> <ciso646> <csetjmp> <cstdio> <ctime>
+<cctype> <climits> <csignal> <cstdlib> <cwchar>
+<cerrno> <clocale> <cstdarg> <cstring> <cwctype>
+<cfloat> <cmath> <cstddef> -std=c++0x
or -std=gnu++0x
.
+<algorithm> <iomanip> <locale> <regex> <tuple>
+<array> <ios> <map> <set> <typeinfo>
+<bitset> <iosfwd> <memory> <sstream> <type_traits>
+<complex> <iostream> <new> <stack> <unordered_map>
+<deque> <istream> <numeric> <stdexcept> <unordered_set>
+<exception> <iterator> <ostream> <streambuf> <utility>
+<fstream> <limits> <queue> <string> <valarray>
+<functional> <list> <random> <system_error> <vector>
+<cassert> <cfloat> <cmath> <cstddef> <ctgmath>
+<ccomplex> <cinttypes> <csetjmp> <cstdint> <ctime>
+<cctype> <ciso646> <csignal> <cstdio> <cuchar>
+<cerrno> <climits> <cstdarg> <cstdlib> <cwchar>
+<cfenv> <clocale> <cstdbool> <cstring> <cwctype>
+<tr1/array> <tr1/memory> <tr1/regex> <tr1/type_traits> <tr1/unordered_set>
+<tr1/complex> <tr1/random> <tr1/tuple> <tr1/unordered_map> <tr1/utility>
+<tr1/functional>
+<tr1/cmath> <tr1/cfloat> <tr1/cstdarg> <tr1/cstdio> <tr1/ctime>
+<tr1/ccomplex> <tr1/cinttypes> <tr1/cstdbool> <tr1/cstdlib> <tr1/cwchar>
+<tr1/cfenv> <tr1/climits> <tr1/cstdint> <tr1/ctgmath> <tr1/cwctype>
+<cxxabi.h> <cxxabi_forced.h>
+<ext/algorithm> <ext/debug_allocator.h> <ext/mt_allocator.h> <ext/pod_char_traits.h> <ext/stdio_sync_filebuf.h>
+<ext/array_allocator.h> <ext/enc_filebuf.h> <ext/new_allocator.h> <ext/pool_allocator.h> <ext/throw_allocator.h>
+<ext/atomicity.h> <ext/functional> <ext/numeric> <ext/rb_tree> <ext/typelist.h>
+<ext/bitmap_allocator.h> <ext/iterator> <ext/numeric_traits.h> <ext/rope> <ext/type_traits.h>
+<ext/codecvt_specializations.h> <ext/malloc_allocator.h> <ext/pb_ds/assoc_container.h> <ext/slist> <ext/vstring.h>
+<ext/concurrence.h> <ext/memory> <ext/pb_ds/priority_queue.h> <ext/stdio_filebuf.h>
+<debug/bitset> <debug/list> <debug/set> <debug/unordered_map> <debug/vector>
+<debug/deque> <debug/map> <debug/string> <debug/unordered_set>
+<parallel/algorithm> <parallel/numeric>
+Recipes for mixing headers
+
+
-C++ Library Headers
-algorithm ios new stack
-array iosfwd numeric stdexcept
-bitset iostream ostream streambuf
-complex istream queue string
-deque iterator random system_error
-exception limits regex tuple
-fstream list set type_traits
-functional locale map typeinfo
-iomanip memory sstream
-
-C++ Headers for C Library Facilities
-cassert cfloat cmath cstddef ctgmath
-ccomplex cinttypes csetjmp cstdio ctime
-cctype ciso646 csignal cstdint cuchar
-cerrno climits cstdarg cstdlib cwchar
-cfenv clocale cstdbool cstring cwctype
+#include <array>
+#include <functional>
-__gnu_cxx::vstring
, or to use the
+debug-mode versions of std::unordered_map
, one must use
+the std=gnu++0x
compiler flag. (Or std=c++0x
, of course.)
-C++ Library Headers
-tr1/array, tr1/complex, tr1/functional, tr1/memory, tr1/random,
-tr1/regex, tr1/tuple, tr1/type_traits, tr1/unordered_map,
-tr1/unordered_set, tr1/utility
-
-C++ Headers for C Library Facilities
-tr1/cmath, tr1/ccomplex, tr1/cfenv, tr1/cfloat, tr1/cinttypes,
-tr1/climits, tr1/cstdarg, tr1/cstdbool, tr1/cstdint, tr1/cstdio,
-tr1/cstdlib, tr1/ctgmath, tr1/ctime, tr1/cwchar, tr1/cwctype
-
-C++ Compatibility Headers for C Library Facilities
-tr1/complex.h, tr1/ctype.h, tr1/float.h, tr1/limits.h, tr1/math.h,
-tr1/stdarg.h, tr1/stdbool.h, tr1/stdint.h, tr1/stdio.h, tr1/stdlib.h,
-tr1/tgmath.h, tr1/wchar.h, tr1/wctype.h
+#include <tr1/type_traits>
+#include <type_traits>
+
-Headers and
+namespace std::
The C Headers and
namespace std
std::
(but
- libstdc++ does not yet have fully compliant headers) On the
- other hand, if you include only the new header (i.e. <cmath>), the symbols
- will only be defined in namespace std::
- (and macros will be converted to inline-functions).
+ The standard specifies that if one includes the C-style header
+ (<math.h> in this case), the symbols will be available
+ in the global namespace and perhaps in
+ namespace std::
(but this is no longer a firm
+ requirement.) One the other hand, including the C++-style
+ header (<cmath>) guarantees that the entities will be
+ found in namespace std and perhaps in the global namespace.
std::abort
. In addition, the C++-style headers can
+use function overloading to provide a simpler interface to certain
+families of C-functions. For instance in <cmath>, the
+function std::sin
has overloads for all the builtin
+floating-point types. This means that std::sin
can be
+used uniformly, instead of a combination
+of std::sinf
, std::sin
,
+and std::sinl
.
+
+
+
+Precompiled Headers
+
+
+
+
+
+g++ -v hello.cc
+
+#include <...> search starts here:
+ /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0
+...
+End of search list.
+
+
+
+
+g++ -Winvalid-pch -x c++-header -g -O2 -o ./stdc++.h.gch /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h
+
+
+
+g++ -I. -include stdc++.h -H -g -O2 hello.cc
+
+
+
+g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe
+! ./stdc++.h.gch
+. /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/iostream
+. /mnt/share/bld/H-x86-gcc.20071201include/c++/4.3.0/string
+
+
+stdc++.h.gch
listing means that the generated PCH file was used, and thus the
-Namespace
+std::
Namespaces
+
+
+
+
+
+namespace std
, such as namespace
+std::tr1
.
+__gnu_cxx
, __gnu_debug
, __gnu_parallel
,
+and __gnu_pbds
.
+
+Namespace
std::
std::string
, std::cout
) Always can be
used, and usually enhanced, by strategic use of typedefs. (In the
-cases where the qualified verbage becomes unweidly.)
+cases where the qualified verbiage becomes unwieldy.)
-Using namespace composition
+Using namespace composition
namespace gtk
. It is possible to
+ adapt namespace gtk
to namespace std
by using a C++-feature called
namespace composition. This is what happens if
- you put a using-declaration into a
+ a using-declaration is put into a
namespace-definition: the imported symbol(s) gets imported into the
currently active namespace(s). For example:
- namespace Gtk {
- using std::string;
- class Window { ... }
- }
-
+
+namespace gtk
+{
+ using std::string;
+ using std::tr1::array;
+
+ class Window { ... };
+}
+
std::string
gets imported into
- namespace Gtk::. The result is that you don't have to use
- std::string
in this header, but still
+ namespace gtk
. The result is that use of
+ std::string
inside namespace gtk can just use string
, without the explicit qualification.
+ As an added bonus,
std::string
does not get imported into
- the global namespace (::) unless the user does
- using namespace Gtk;
(which is not recommended
- practice for Gtk--, so it is not a problem). Additionally, the
- using
-declarations are wrapped in macros that
+ the global namespace. Additionally, a more elaborate arrangement can be made for backwards compatibility and portability, whereby the
+ using
-declarations can wrapped in macros that
are set based on autoconf-tests to either "" or i.e. using
std::string;
(depending on whether the system has
libstdc++ in std::
or not). (ideas from
@@ -206,7 +401,103 @@ cases where the qualified verbage becomes unweidly.)
-The Standard C++ library and multithreading
+Macros for libstdc++
+
+ c++config.h
, which is generated during
+ the libstdc++ configuration and build process, and included by
+ files part of the public libstdc++ API. Most of these macros
+ should not be used by consumers of libstdc++, and are reserved
+ for internal implementation use. These macros cannot be
+ redefined. However, a select handful of these macro
+ control libstdc++ extensions and extra features, or provide
+ versioning information for the API, and are able to be used.
+ _GLIBCXX_
(except for
+ versions 3.1.x to 3.3.x, which use _GLIBCPP_
).
+
+
+
+ __GLIBCXX__
+
+
+_GLIBCXX_DEPRECATED
-std=c++98
and -std=c++0x
. This may
+ be useful in updating old C++ code which no longer meet the
+ requirements of the language, or for checking current code
+ against new language standards. _GLIBCXX_FORCE_NEW
--enable-libstdcxx-allocator
. ABI-changing.
+ _GLIBCXX_CONCEPT_CHECKS
--enable-concept-checks
.
+ When defined, performs compile-time checking on certain template
+ instantiations to detect violations of the requirements of the
+ standard. This is described in more detail here._GLIBCXX_DEBUG
_GLIBCXX_DEBUG_PEDANTIC
_GLIBCXX_PARALLEL
+The Standard C++ library and multithreading
-Macros for libstdc++
-
- c++config.h
, which is generated during
- the libstdc++ configuration and build process, and included by
- files part of the public libstdc++ API. Most of these macros
- should not be used by consumers of libstdc++, and are reserved
- for internal implementation use. These macros cannot be
- redefined. However, a select handful of these macro
- control libstdc++ extensions and extra features, or provide
- versioning information for the API, and are able to be used.
- _GLIBCXX_
(except for
- versions 3.1.x to 3.3.x, which use _GLIBCPP_
).
-
-
-
- __GLIBCXX__
-
_GLIBCXX_DEPRECATED
-std=c++98
and -std=c++0x
. This may
- be useful in updating old C++ code which no longer meet the
- requirements of the language, or for checking current code
- against new language standards. _GLIBCXX_FORCE_NEW
--enable-libstdcxx-allocator
. ABI-changing.
- _GLIBCXX_CONCEPT_CHECKS
--enable-concept-checks
.
- When defined, performs compile-time checking on certain template
- instantiations to detect violations of the requirements of the
- standard. This is described in more detail here._GLIBCXX_DEBUG
_GLIBCXX_DEBUG_PEDANTIC
_GLIBCXX_PARALLEL
std::set_terminate(std::abort);-
Return to top of page or - to the FAQ. -
This function will attempt to write to stderr. If your application @@ -292,6 +289,11 @@ unspecified manner.
+Return to top of page or + to the FAQ. +
+ +There are six flavors each of new
and
diff --git a/libstdc++-v3/docs/html/20_util/allocator.html b/libstdc++-v3/docs/html/20_util/allocator.html
index 409c08b..951c12d 100644
--- a/libstdc++-v3/docs/html/20_util/allocator.html
+++ b/libstdc++-v3/docs/html/20_util/allocator.html
@@ -84,34 +84,47 @@
The easiest way of fulfilling the requirements is to call operator new each time a container needs memory, and to call operator delete each - time the container releases memory. BUT - this - method is horribly slow. -
-Or we can keep old memory around, and reuse it in a pool to save time. - The old libstdc++-v2 used a memory pool, and so do we. As of 3.0, - it's - on by default. The pool is shared among all the containers in the - program: when your program's std::vector<int> gets cut in half - and frees a bunch of its storage, that memory can be reused by the - private std::list<WonkyWidget> brought in from a KDE library - that you linked against. And we don't have to call operators new and - delete to pass the memory on, either, which is a speed bonus. - BUT... -
-What about threads? No problem: in a threadsafe environment, the - memory pool is manipulated atomically, so you can grow a container in - one thread and shrink it in another, etc. BUT what - if threads in libstdc++ aren't set up properly? - That's been answered already. -
-BUT what if you want to use your own allocator? What - if you plan on using a runtime-loadable version of malloc() which uses - shared telepathic anonymous mmap'd sections serializable over a - network, so that memory requests should go through malloc? - And what if you need to debug it? -
+ time the container releases memory. This method may be + slower + than caching the allocations and re-using previously-allocated + memory, but has the advantage of working correctly across a wide + variety of hardware and operating systems, including large + clusters. The__gnu_cxx::new_allocator
implements
+ the simple operator new and operator delete semantics, while __gnu_cxx::malloc_allocator
implements much the same thing, only with the C language functions std::malloc
and std::free
.
+
+
+ Another approach is to use intelligence within the allocator class
+to cache allocations. This extra machinery can take a variety of
+forms: a bitmap index, an index into an exponentially increasing
+power-of-two-sized buckets, or simpler fixed-size pooling cache. The
+cache is shared among all the containers in the program: when your
+program's std::vector<int> gets cut in half and frees a bunch of
+its storage, that memory can be reused by the private
+std::list<WonkyWidget> brought in from a KDE library that you
+linked against. And operators new and delete are not always called to
+pass the memory on, either, which is a speed bonus. Examples of
+allocators that use these techniques
+are __gnu_cxx::bitmap_allocator
, __gnu_cxx::pool_allocator
,
+and __gnu_cxx::__mt_alloc
.
+
Depending on the implementation techniques used, the underlying
+operating system, and compilation environment, scaling caching
+allocators can be tricky. In particular, order-of-destruction and
+order-of-creation for memory pools may be difficult to pin down with
+certainty, which may create problems when used with plugins or loading
+and unloading shared objects in memory. As such, using caching
+allocators on systems that do not
+support abi::__cxa_atexit
is not recommended.
+
Versions of libstdc++ prior to 3.4 cache allocations in a memory
+ pool, instead of passing through to call the global allocation
+ operators (ie, __gnu_cxx::pool_allocator
). More
+ recent versions default to the
+ simpler __gnu_cxx::new_allocator
.
+
std::allocator
More details on each of these extension allocators follows.
@@ -371,6 +389,12 @@ size is checked, and assert() is used to guarantee they match. +throw_allocator
+ Includes memory tracking and marking abilities as well as hooks for + throwing exceptinos at configurable intervals (including random, + all, none). +
+__pool_alloc
A high-performance, single pool allocator. The reusable memory is shared among identical instantiations of this type. diff --git a/libstdc++-v3/docs/html/documentation.html b/libstdc++-v3/docs/html/documentation.html index 92ce87b..d2a736f 100644 --- a/libstdc++-v3/docs/html/documentation.html +++ b/libstdc++-v3/docs/html/documentation.html @@ -26,7 +26,7 @@ href="http://gcc.gnu.org/libstdc++">project to implement the ISO annex D, extensions as described by TR1, and future C++ library standards still in progress. For those who want to see exactly how far the project has come, or just want the latest bleeding-edge code, the -up-to-date source is always publically available over anonymous SVN, +up-to-date source is always publicly available over anonymous SVN, and can be browsed over the web.
@@ -34,13 +34,6 @@ href="http://gcc.gnu.org/svn.html">web.Stable versions of libstdc++ are included with releases of the GCC compilers.
- -namespace std
namespace std
+ The latest version of this document is always available at + + http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/concurrence.html. +
+ ++ To the libstdc++ homepage. +
+ + + + +The interface for concurrency support is divided into two files: +<ext/atomicity.h> which provides support for atomic operations, +and <ext/concurrence.h>, which provides mutex and lock objects +as well as compile-time data structures for querying thread +support.
+ +It is expected that support for concurrence will evolve into what +is specified in the draft C++0x standard.
+ ++Two functions and one type form the base of atomic support. +
+ + +The type _Atomic_word
is a signed integral type
+supporting atomic operations.
+
+The two functions functions are: +
+ ++_Atomic_word +__exchange_and_add_dispatch(volatile _Atomic_word*, int); + +void +__atomic_add_dispatch(volatile _Atomic_word*, int); ++ +
Both of these functions are declared in the header file
+<ext/atomicity.h>, and are in namespace __gnu_cxx
.
+
+__exchange_and_add_dispatch
+
+Adds the second argument's value to the first argument. Returns the old value. +
+
+__atomic_add_dispatch
+
+Adds the second argument's value to the first argument. Has no return value. +
+
+
+__exchange_and_add_dispatch
+
+
+Calls through to either of: +
+ +__exchange_and_add
+Multi-thread version. Inlined if compiler-generated builtin atomics +can be used, otherwise resolved at link time to a non-builtin code +sequence. +
+__exchange_and_add_single
+Single threaded version. Inlined.
+However, only __exchange_and_add_dispatch
+and __atomic_add_dispatch
should be used. These functions
+can be used in a portable manner, regardless of the specific
+environment. They are carefully designed to provide optimum efficiency
+and speed, abstracting out atomic accesses when they are not required
+(even on hosts that support compiler intrinsics for atomic
+operations.)
+
+In addition, there are two macros +
+ +
+
+_GLIBCXX_READ_MEM_BARRIER
+
+
+
+GLIBCXX_WRITE_MEM_BARRIER
+
+
+Which expand to the appropriate write and read barrier required by the +host hardware and operating system. +
+ +A thin layer above IEEE 1003.1 (ie pthreads) is used to abastract +the thread interface for GCC. This layer is called "gthread," and is +comprised of one header file that wraps the host's default thread layer with +a POSIX-like interfaces. +
+ +The file <gthr-default.h> points to the deduced wrapper for +the current host. In libstdc++ implementation files, +<bits/gthr.h> is used to select the proper gthreads file. +
+ +Within libstdc++ sources, all calls to underlying thread functionality +use this layer. More detail as to the specific interface can be found in the source documentation. +
+ +By design, the gthread layer is interoperable with the types,
+functions, and usage found in the usual <pthread.h> file,
+including pthread_t
, pthread_once_t
, pthread_create
,
+etc.
+
The file <ext/concurrence.h> contains all the higher-level
+constructs for playing with threads. In contrast to the atomics layer,
+the concurrence layer consists largely of types. All types are defined within namespace __gnu_cxx
.
+
+These types can be used in a portable manner, regardless of the +specific environment. They are carefully designed to provide optimum +efficiency and speed, abstracting out underlying thread calls and +accesses when compiling for single-threaded situations (even on hosts +that support multiple threads.) +
+ +The enumerated type _Lock_policy
details the set of
+available locking
+policies: _S_single
, _S_mutex
,
+and _S_atomic
.
+
_S_single
+Indicates single-threaded code that does not need locking. +
+ +_S_mutex
+Indicates multi-threaded code using thread-layer abstractions. +
+_S_atomic
+Indicates multi-threaded code using atomic operations. +
+The compile-time constant __default_lock_policy
is set
+to one of the three values above, depending on characteristics of the
+host environment and the current compilation flags.
+
Two more datatypes make up the rest of the
+interface: __mutex
, and __scoped_lock
.
+
+
+ +The scoped lock idiom is well-discussed within the C++
+community. This version takes a __mutex
reference, and
+locks it during construction of __scoped_locke
and
+unlocks it during destruction. This is an efficient way of locking
+critical sections, while retaining exception-safety.
+
Typical usage of the last two constructs is demonstrated as follows: +
+ ++#include <ext/concurrence.h> + +namespace +{ + __gnu_cxx::__mutex safe_base_mutex; +} // anonymous namespace + +namespace other +{ + void + foo() + { + __gnu_cxx::__scoped_lock sentry(safe_base_mutex); + for (int i = 0; i < max; ++i) + { + _Safe_iterator_base* __old = __iter; + __iter = __iter->_M_next; + __old->_M_detach_single(); + } +} ++ +
In this sample code, an anonymous namespace is used to keep
+the __mutex
private to the compilation unit,
+and __scoped_lock
is used to guard access to the critical
+section within the for loop, locking the mutex on creation and freeing
+the mutex as control moves out of this block.
+
Several exception classes are used to keep track of
+concurrence-related errors. These classes
+are: __concurrence_lock_error
, __concurrence_unlock_error
, __concurrence_wait_error
,
+and __concurrence_broadcast_error
.
+
The functions for atomic operations described above are either +implemented via compiler intrinsics (if the underlying host is +capable) or by library fallbacks.
+ +Compiler intrinsics (builtins) are always preferred. However, as
+the compiler builtins for atomics are not universally implemented,
+using them directly is problematic, and can result in undefined
+function calls. (An example of an undefined symbol from the use
+of __sync_fetch_and_add
on an unsupported host is a
+missing reference to __sync_fetch_and_add_4
.)
+
In addition, on some hosts the compiler intrinsics are enabled
+conditionally, via the -march
command line flag. This makes
+usage vary depending on the target hardware and the flags used during
+compile.
+
If builtins are possible, _GLIBCXX_ATOMIC_BUILTINS
+will be defined.
+
For the following hosts, intrinsics are enabled by default. +
+ +For others, some form of -march
may work. On
+non-ancient x86 hardware, -march=native
usually does the
+trick.
For hosts without compiler intrinsics, but with capable +hardware, hand-crafted assembly is selected. This is the case for the following hosts: +
+ +And for the rest, a simulated atomic lock via pthreads. +
+ +Detailed information about compiler intrinsics for atomic operations can be found in the GCC documentation. +
+ +More details on the library fallbacks from the porting section. +
+ + + + + + diff --git a/libstdc++-v3/docs/html/ext/howto.html b/libstdc++-v3/docs/html/ext/howto.html index 3171355..2e88c66 100644 --- a/libstdc++-v3/docs/html/ext/howto.html +++ b/libstdc++-v3/docs/html/ext/howto.html @@ -74,18 +74,13 @@ are deprecated but available as backwards-compatible extensions, as discussed further below.<rope>
is the
SGI specialization for large strings ("rope,"
- "large strings," get it? love those SGI folks).
+ "large strings," get it? Love that geeky humor.)
<slist>
is a singly-linked list, for when the
doubly-linked list<>
is too much space
overhead, and <rb_tree>
exposes the red-black
tree classes used in the implementation of the standard maps and
sets.
- Okay, about those hashing classes... these classes have been - deprecated by the unordered_set, unordered_multiset, unordered_map, - unordered_multimap containers in TR1 and the upcoming C++0x, and - may be removed in future releases. -
Each of the associative containers map, multimap, set, and multiset
have a counterpart which uses a
hashing
@@ -111,11 +106,13 @@
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.)
+
+ Okay, about the SGI hashing classes... these classes have been
+ deprecated by the unordered_set, unordered_multiset, unordered_map,
+ unordered_multimap containers in TR1 and the upcoming C++0x, and
+ may be removed in future releases.
Return to top of page or
to the FAQ.
This page describes the extensions that SGI made to their version of the
- STL subset of the Standard C++ Library. For a time we
- tracked and imported changes and updates
- from most of the SGI STL, up through their (apparently) final release.
- Their extensions were mostly preserved.
+ This page describes the extensions that SGI made to the STL subset
+ of the Standard C++ Library, which also includes work from the
+ originating HP codebase. This work is the basis for much of
+ libstdc++, and where possible these extensions have been
+ preserved.
They are listed according to the chapters of the library that they
- extend (see the chapter-specific notes
- for a description). Not every chapter may have extensions, and the
- extensions may come and go. Also, this page is incomplete because the
- author is pressed for time. Check back often; the latest change was on
- $Date: 2003/04/16 17:02:47 $ (UTC).
+ What follows is a listing of these extensions, according to the
+ chapters of the library that they extend
+ (see the chapter-specific
+ notes for a description). Not every chapter has extensions,
+ and existing extensions may be removed (or moved) as their
+ functionality is standardized.
Descriptions range from the scanty to the verbose. You should also check
- the generated documentation for notes
- and comments, especially for entries marked with '*'. For more complete
- doumentation, see the SGI website. For really complete
- documentation, buy a copy of Matt Austern's book. *grin*
+ Descriptions range from the scanty to the verbose. Also check
+ the generated documentation
+ for notes and comments, especially for entries marked with '*'.
+ For more complete doumentation, see the SGI website.
+ For really complete documentation, consider perusing a
+ copy of Matt Austern's book "Generic Programming and the STL."
Back to the libstdc++ extensions.
diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html
index e353a1f..ff6cd65 100644
--- a/libstdc++-v3/docs/html/faq/index.html
+++ b/libstdc++-v3/docs/html/faq/index.html
@@ -1052,14 +1052,26 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
libstdc++ strives to be thread-safe when all of the following
+ The library strives to be thread-safe when all of the following
conditions are met:
Look for "Thread model" lines that aren't equal to "single." The user-code must guard against concurrent method calls which may
access any particular library object's state. Typically, the
diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index df9c217..7e7c268 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -1,6 +1,6 @@
// C++ includes used for precompiling -*- C++ -*-
-// Copyright (C) 2003 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -51,6 +51,17 @@
#include SGI extensions to the library in
-libstdc++
+HP/SGI STL extensions
-
5.6 Is libstdc++ thread-safe?
-
gcc -v
reports a thread model other than 'single',gcc -v
. Multi-thread capable versions of gcc output something like this:
+
+%gcc -v
+Using built-in specs.
+...
+Thread model: posix
+gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
+
+
+-pthread
and -march=native
, although specifics vary depending on the host environment. See Machine Dependent Options.