From fbc3fee390d24b22182eb4535fb3667faa40a72d Mon Sep 17 00:00:00 2001
From: Jonathan Wakely
Date: Thu, 28 Nov 2002 19:15:04 +0000
Subject: [PATCH] index.html: Add tip about namespace for extensions.
2002-11-28 Jonathan Wakely
* docs/html/faq/index.html: Add tip about namespace for extensions.
From-SVN: r59613
---
libstdc++-v3/ChangeLog | 3 +++
libstdc++-v3/docs/html/faq/index.html | 28 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b18948e3f07..5efdd974f97 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,6 @@
+2002-11-28 Jonathan Wakely
+ * docs/html/faq/index.html: Add tip about a namespace for extensions.
+
2002-11-28 Paolo Carlini
Nathan Myers
diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html
index f7a9b0ac708..f472bfc9dc6 100644
--- a/libstdc++-v3/docs/html/faq/index.html
+++ b/libstdc++-v3/docs/html/faq/index.html
@@ -877,6 +877,34 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
that of other headers whose directories are not searched directly,
e.g., <sys/stat.h>
, <X11/Xlib.h>
.
+
+ The extensions are no longer in the global or std
+ namespaces, instead they are declared in the __gnu_cxx
+ namespace. For maximum portability, consider defining a namespace
+ alias to use to talk about extensions, e.g.:
+
+
+ #ifdef __GNUC__
+ #if __GNUC__ < 3
+ #include <hash_map.h>
+ namespace Sgi { using ::hash_map; }; // inherit globals
+ #else
+ #include <ext/hash_map>
+ #if __GNUC_MINOR__ == 0
+ namespace Sgi = std; // GCC 3.0
+ #else
+ namespace Sgi = ::__gnu_cxx; // GCC 3.1 and later
+ #endif
+ #endif
+ #else // ... there are other compilers, right?
+ namespace Sgi = std;
+ #endif
+
+ Sgi::hash_map<int,int> my_map;
+ This is a bit cleaner than defining typedefs for all the
+ instantiations you might need.
+
+
Extensions to the library have
their own page.