Index: docs/html/faq/index.html =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/faq/index.html,v retrieving revision 1.47 diff -u -r1.47 index.html --- docs/html/faq/index.html 21 Nov 2002 07:16:01 -0000 1.47 +++ docs/html/faq/index.html 27 Nov 2002 11:46:51 -0000 @@ -877,6 +877,31 @@ 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>
+        namespace Sgi = ::__gnu_cxx;
+      #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.