OSDN Git Service

* doc/xml/manual/status_cxx2011.xml: Document that N3189 is missing.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / doc / xml / manual / backwards_compatibility.xml
1 <section xmlns="http://docbook.org/ns/docbook" version="5.0" 
2          xml:id="manual.appendix.porting.backwards" xreflabel="backwards">
3 <?dbhtml filename="backwards.html"?>
4
5 <info><title>Backwards Compatibility</title>
6   <keywordset>
7     <keyword>
8       ISO C++
9     </keyword>
10     <keyword>
11       backwards
12     </keyword>
13   </keywordset>
14 </info>
15
16
17
18 <section xml:id="backwards.first"><info><title>First</title></info>
19
20
21 <para>The first generation GNU C++ library was called libg++.  It was a
22 separate GNU project, although reliably paired with GCC. Rumors imply
23 that it had a working relationship with at least two kinds of
24 dinosaur.
25 </para>
26
27 <para>Some background: libg++ was designed and created when there was no
28 ISO standard to provide guidance.  Classes like linked lists are now
29 provided for by <classname>list&lt;T&gt;</classname> and do not need to be
30 created by <function>genclass</function>.  (For that matter, templates exist
31 now and are well-supported, whereas genclass (mostly) predates them.)
32 </para>
33
34 <para>There are other classes in libg++ that are not specified in the
35 ISO Standard (e.g., statistical analysis).  While there are a lot of
36 really useful things that are used by a lot of people, the Standards
37 Committee couldn't include everything, and so a lot of those
38 <quote>obvious</quote> classes didn't get included.
39 </para>
40
41 <para>Known Issues include many of the limitations of its immediate ancestor.</para>
42
43 <para>Portability notes and known implementation limitations are as follows.</para>
44
45 <section xml:id="backwards.first.ios_base"><info><title>No <code>ios_base</code></title></info>
46   
47
48 <para> At least some older implementations don't have <code>std::ios_base</code>, so you should use <code>std::ios::badbit</code>, <code>std::ios::failbit</code> and <code>std::ios::eofbit</code> and <code>std::ios::goodbit</code>.
49 </para>
50 </section>
51
52 <section xml:id="backwards.first.cout_cin"><info><title>No <code>cout</code> in <filename class="headerfile">&lt;ostream.h&gt;</filename>, no <code>cin</code> in <filename class="headerfile">&lt;istream.h&gt;</filename></title></info>
53
54
55 <para>
56         In earlier versions of the standard,
57         <filename class="headerfile">&lt;fstream.h&gt;</filename>,
58         <filename class="headerfile">&lt;ostream.h&gt;</filename>
59         and <filename class="headerfile">&lt;istream.h&gt;</filename>
60         used to define
61         <code>cout</code>, <code>cin</code> and so on. ISO C++ specifies that one needs to include
62         <filename class="headerfile">&lt;iostream&gt;</filename>
63         explicitly to get the required definitions.
64  </para>
65 <para> Some include adjustment may be required.</para>
66
67 <para>This project is no longer maintained or supported, and the sources
68 archived. For the desperate,
69 the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/extensions.html">GCC extensions
70 page</link> describes where to find the last libg++ source. The code is
71 considered replaced and rewritten.
72 </para>
73 </section>
74 </section>
75
76 <section xml:id="backwards.second"><info><title>Second</title></info>
77
78
79 <para>
80   The second generation GNU C++ library was called libstdc++, or
81   libstdc++-v2. It spans the time between libg++ and pre-ISO C++
82   standardization and is usually associated with the following GCC
83   releases: egcs 1.x, gcc 2.95, and gcc 2.96.
84 </para>
85
86 <para>
87   The STL portions of this library are based on SGI/HP STL release 3.11.
88 </para>
89
90 <para>
91   This project is no longer maintained or supported, and the sources
92   archived.  The code is considered replaced and rewritten.
93 </para>
94
95 <para>
96   Portability notes and known implementation limitations are as follows.
97 </para>
98
99 <section xml:id="backwards.second.std"><info><title>Namespace <code>std::</code> not supported</title></info>
100   
101
102   <para>
103     Some care is required to support C++ compiler and or library
104     implementation that do not have the standard library in
105     <code>namespace std</code>.
106   </para>
107
108   <para>
109     The following sections list some possible solutions to support compilers
110     that cannot ignore <code>std::</code>-qualified names.
111   </para>
112
113   <para>
114     First, see if the compiler has a flag for this. Namespace
115     back-portability-issues are generally not a problem for g++
116     compilers that do not have libstdc++ in <code>std::</code>, as the
117     compilers use <option>-fno-honor-std</option> (ignore
118     <code>std::</code>, <code>:: = std::</code>) by default. That is,
119     the responsibility for enabling or disabling <code>std::</code> is
120     on the user; the maintainer does not have to care about it. This
121     probably applies to some other compilers as well.
122   </para>
123
124   <para>
125     Second, experiment with a variety of pre-processor tricks.
126   </para>
127
128   <para>
129     By defining <code>std</code> as a macro, fully-qualified namespace
130     calls become global. Volia.
131   </para>
132
133 <programlisting>
134 #ifdef WICKEDLY_OLD_COMPILER
135 # define std
136 #endif
137 </programlisting>
138
139   <para>
140     Thanks to Juergen Heinzl who posted this solution on gnu.gcc.help.
141   </para>
142
143   <para>
144     Another pre-processor based approach is to define a macro
145     <code>NAMESPACE_STD</code>, which is defined to either
146     <quote> </quote> or <quote>std</quote> based on a compile-type
147     test. On GNU systems, this can be done with autotools by means of
148     an autoconf test (see below) for <code>HAVE_NAMESPACE_STD</code>,
149     then using that to set a value for the <code>NAMESPACE_STD</code>
150     macro.  At that point, one is able to use
151     <code>NAMESPACE_STD::string</code>, which will evaluate to
152     <code>std::string</code> or <code>::string</code> (i.e., in the
153     global namespace on systems that do not put <code>string</code> in
154     <code>std::</code>).
155   </para>
156
157 <programlisting>
158 dnl @synopsis AC_CXX_NAMESPACE_STD
159 dnl
160 dnl If the compiler supports namespace std, define
161 dnl HAVE_NAMESPACE_STD.
162 dnl
163 dnl @category Cxx
164 dnl @author Todd Veldhuizen
165 dnl @author Luc Maisonobe &lt;luc@spaceroots.org&gt;
166 dnl @version 2004-02-04
167 dnl @license AllPermissive
168 AC_DEFUN([AC_CXX_NAMESPACE_STD], [
169   AC_CACHE_CHECK(if g++ supports namespace std,
170   ac_cv_cxx_have_std_namespace,
171   [AC_LANG_SAVE
172   AC_LANG_CPLUSPLUS
173   AC_TRY_COMPILE([#include &lt;iostream&gt;
174                   std::istream&amp; is = std::cin;],,
175   ac_cv_cxx_have_std_namespace=yes, ac_cv_cxx_have_std_namespace=no)
176   AC_LANG_RESTORE
177   ])
178   if test "$ac_cv_cxx_have_std_namespace" = yes; then
179     AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
180   fi
181 ])
182 </programlisting>
183 </section>
184
185 <section xml:id="backwards.second.iterators"><info><title>Illegal iterator usage</title></info>
186
187 <para>
188   The following illustrate implementation-allowed illegal iterator
189   use, and then correct use.
190 </para>
191
192 <itemizedlist>
193   <listitem>
194     <para>
195       you cannot do <code>ostream::operator&lt;&lt;(iterator)</code>
196       to print the address of the iterator =&gt; use
197       <code>operator&lt;&lt; &amp;*iterator</code> instead
198     </para>
199   </listitem>
200   <listitem>
201     <para>
202       you cannot clear an iterator's reference (<code>iterator =
203       0</code>) =&gt; use <code>iterator = iterator_type();</code>
204     </para>
205   </listitem>
206   <listitem>
207     <para>
208       <code>if (iterator)</code> won't work any more =&gt; use
209       <code>if (iterator != iterator_type())</code>
210     </para>
211   </listitem>
212 </itemizedlist>
213 </section>
214
215 <section xml:id="backwards.second.isspace"><info><title><code>isspace</code> from <filename class="headerfile">&lt;cctype&gt;</filename> is a macro
216   </title></info>
217   
218
219   <para>
220     Glibc 2.0.x and 2.1.x define <filename class="headerfile">&lt;ctype.h&gt;</filename> functionality as macros
221     (isspace, isalpha etc.).
222   </para>
223
224   <para>
225     This implementations of libstdc++, however, keep these functions
226     as macros, and so it is not back-portable to use fully qualified
227     names. For example:
228   </para>
229
230 <programlisting>
231 #include &lt;cctype&gt;
232 int main() { std::isspace('X'); }
233 </programlisting>
234
235 <para>
236   Results in something like this:
237 </para>
238
239 <programlisting>
240 std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int) _ISspace ) ;
241 </programlisting>
242
243 <para>
244   A solution is to modify a header-file so that the compiler tells
245   <filename class="headerfile">&lt;ctype.h&gt;</filename> to define functions
246   instead of macros:
247 </para>
248
249 <programlisting>
250 // This keeps isalnum, et al from being propagated as macros.
251 #if __linux__
252 # define __NO_CTYPE 1
253 #endif
254 </programlisting>
255
256 <para>
257   Then, include <filename class="headerfile">&lt;ctype.h&gt;</filename>
258 </para>
259
260 <para>
261   Another problem arises if you put a <code>using namespace
262   std;</code> declaration at the top, and include
263   <filename class="headerfile">&lt;ctype.h&gt;</filename>. This will
264   result in ambiguities between the definitions in the global namespace
265   (<filename class="headerfile">&lt;ctype.h&gt;</filename>) and the
266   definitions in namespace <code>std::</code>
267   (<code>&lt;cctype&gt;</code>).
268 </para>
269 </section>
270
271 <section xml:id="backwards.second.at"><info><title>No <code>vector::at</code>, <code>deque::at</code>, <code>string::at</code></title></info>
272
273
274 <para>
275   One solution is to add an autoconf-test for this:
276 </para>
277
278 <programlisting>
279 AC_MSG_CHECKING(for container::at)
280 AC_TRY_COMPILE(
281 [
282 #include &lt;vector&gt;
283 #include &lt;deque&gt;
284 #include &lt;string&gt;
285
286 using namespace std;
287 ],
288 [
289 deque&lt;int&gt; test_deque(3);
290 test_deque.at(2);
291 vector&lt;int&gt; test_vector(2);
292 test_vector.at(1);
293 string test_string(<quote>test_string</quote>);
294 test_string.at(3);
295 ],
296 [AC_MSG_RESULT(yes)
297 AC_DEFINE(HAVE_CONTAINER_AT)],
298 [AC_MSG_RESULT(no)])
299 </programlisting>
300
301 <para>
302   If you are using other (non-GNU) compilers it might be a good idea
303   to check for <code>string::at</code> separately.
304 </para>
305
306 </section>
307
308 <section xml:id="backwards.second.eof"><info><title>No <code>std::char_traits&lt;char&gt;::eof</code></title></info>
309
310
311 <para>
312   Use some kind of autoconf test, plus this:
313 </para>
314
315 <programlisting>
316 #ifdef HAVE_CHAR_TRAITS
317 #define CPP_EOF std::char_traits&lt;char&gt;::eof()
318 #else
319 #define CPP_EOF EOF
320 #endif
321 </programlisting>
322
323 </section>
324
325 <section xml:id="backwards.second.stringclear"><info><title>No <code>string::clear</code></title></info>
326
327
328 <para>
329   There are two functions for deleting the contents of a string:
330   <code>clear</code> and <code>erase</code> (the latter returns the
331   string).
332 </para>
333
334 <programlisting>
335 void
336 clear() { _M_mutate(0, this-&gt;size(), 0); }
337 </programlisting>
338
339 <programlisting>
340 basic_string&amp;
341 erase(size_type __pos = 0, size_type __n = npos)
342 {
343   return this-&gt;replace(_M_check(__pos), _M_fold(__pos, __n),
344                           _M_data(), _M_data());
345 }
346 </programlisting>
347
348 <para>
349   Unfortunately, <code>clear</code> is not implemented in this
350   version, so you should use <code>erase</code> (which is probably
351   faster than <code>operator=(charT*)</code>).
352 </para>
353 </section>
354
355 <section xml:id="backwards.second.ostreamform_istreamscan"><info><title>
356   Removal of <code>ostream::form</code> and <code>istream::scan</code>
357   extensions
358 </title></info>
359
360
361 <para>
362   These are no longer supported. Please use stringstreams instead.
363 </para>
364 </section>
365
366 <section xml:id="backwards.second.stringstreams"><info><title>No <code>basic_stringbuf</code>, <code>basic_stringstream</code></title></info>
367
368
369 <para>
370   Although the ISO standard <code>i/ostringstream</code>-classes are
371   provided, (<filename class="headerfile">&lt;sstream&gt;</filename>), for
372   compatibility with older implementations the pre-ISO
373   <code>i/ostrstream</code> (<filename class="headerfile">&lt;strstream&gt;</filename>) interface is also provided,
374   with these caveats:
375 </para>
376
377 <itemizedlist>
378   <listitem>
379     <para>
380       <code>strstream</code> is considered to be deprecated
381     </para>
382   </listitem>
383   <listitem>
384     <para>
385       <code>strstream</code> is limited to <code>char</code>
386     </para>
387   </listitem>
388   <listitem>
389     <para>
390       with <code>ostringstream</code> you don't have to take care of
391       terminating the string or freeing its memory
392     </para>
393   </listitem>
394   <listitem>
395     <para>
396       <code>istringstream</code> can be re-filled (clear();
397       str(input);)
398     </para>
399   </listitem>
400 </itemizedlist>
401
402 <para>
403   You can then use output-stringstreams like this:
404 </para>
405
406 <programlisting>
407 #ifdef HAVE_SSTREAM
408 # include &lt;sstream&gt;
409 #else
410 # include &lt;strstream&gt;
411 #endif
412
413 #ifdef HAVE_SSTREAM
414   std::ostringstream oss;
415 #else
416   std::ostrstream oss;
417 #endif
418
419 oss &lt;&lt; <quote>Name=</quote> &lt;&lt; m_name &lt;&lt; <quote>, number=</quote> &lt;&lt; m_number &lt;&lt; std::endl;
420 ...
421 #ifndef HAVE_SSTREAM
422   oss &lt;&lt; std::ends; // terminate the char*-string
423 #endif
424
425 // str() returns char* for ostrstream and a string for ostringstream
426 // this also causes ostrstream to think that the buffer's memory
427 // is yours
428 m_label.set_text(oss.str());
429 #ifndef HAVE_SSTREAM
430   // let the ostrstream take care of freeing the memory
431   oss.freeze(false);
432 #endif
433 </programlisting>
434
435 <para>
436       Input-stringstreams can be used similarly:
437 </para>
438
439 <programlisting>
440 std::string input;
441 ...
442 #ifdef HAVE_SSTREAM
443 std::istringstream iss(input);
444 #else
445 std::istrstream iss(input.c_str());
446 #endif
447
448 int i;
449 iss &gt;&gt; i;
450 </programlisting>
451
452 <para> One (the only?) restriction is that an istrstream cannot be re-filled:
453 </para>
454
455 <programlisting>
456 std::istringstream iss(numerator);
457 iss &gt;&gt; m_num;
458 // this is not possible with istrstream
459 iss.clear();
460 iss.str(denominator);
461 iss &gt;&gt; m_den;
462 </programlisting>
463
464 <para>
465 If you don't care about speed, you can put these conversions in
466       a template-function:
467 </para>
468 <programlisting>
469 template &lt;class X&gt;
470 void fromString(const string&amp; input, X&amp; any)
471 {
472 #ifdef HAVE_SSTREAM
473 std::istringstream iss(input);
474 #else
475 std::istrstream iss(input.c_str());
476 #endif
477 X temp;
478 iss &gt;&gt; temp;
479 if (iss.fail())
480 throw runtime_error(..)
481 any = temp;
482 }
483 </programlisting>
484
485 <para>
486   Another example of using stringstreams is in <link linkend="strings.string.shrink">this howto</link>.
487 </para>
488
489 <para> There is additional information in the libstdc++-v2 info files, in
490 particular <quote>info iostream</quote>.
491 </para>
492 </section>
493
494 <section xml:id="backwards.second.wchar"><info><title>Little or no wide character support</title></info>
495   
496   <para>
497     Classes <classname>wstring</classname> and
498     <classname>char_traits&lt;wchar_t&gt;</classname> are
499     not supported.
500   </para>
501 </section>
502
503 <section xml:id="backwards.second.iostream_templates"><info><title>No templatized iostreams</title></info>
504   
505   <para>
506     Classes <classname>wfilebuf</classname> and
507     <classname>wstringstream</classname> are not supported.
508   </para>
509 </section>
510
511 <section xml:id="backwards.second.thread_safety"><info><title>Thread safety issues</title></info>
512
513
514   <para>
515     Earlier GCC releases had a somewhat different approach to
516     threading configuration and proper compilation.  Before GCC 3.0,
517     configuration of the threading model was dictated by compiler
518     command-line options and macros (both of which were somewhat
519     thread-implementation and port-specific).  There were no
520     guarantees related to being able to link code compiled with one
521     set of options and macro setting with another set.
522   </para>
523
524   <para>
525     For GCC 3.0, configuration of the threading model used with
526     libraries and user-code is performed when GCC is configured and
527     built using the --enable-threads and --disable-threads options.
528     The ABI is stable for symbol name-mangling and limited functional
529     compatibility exists between code compiled under different
530     threading models.
531   </para>
532
533    <para>
534      The libstdc++ library has been designed so that it can be used in
535      multithreaded applications (with libstdc++-v2 this was only true
536      of the STL parts.)  The first problem is finding a
537      <emphasis>fast</emphasis> method of implementation portable to
538      all platforms.  Due to historical reasons, some of the library is
539      written against per-CPU-architecture spinlocks and other parts
540      against the gthr.h abstraction layer which is provided by gcc.  A
541      minor problem that pops up every so often is different
542      interpretations of what "thread-safe" means for a
543      library (not a general program).  We currently use the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.sgi.com/tech/stl/thread_safety.html">same
544      definition that SGI</link> uses for their STL subset.  However,
545      the exception for read-only containers only applies to the STL
546      components. This definition is widely-used and something similar
547      will be used in the next version of the C++ standard library.
548    </para>
549
550    <para>
551      Here is a small link farm to threads (no pun) in the mail
552      archives that discuss the threading problem.  Each link is to the
553      first relevant message in the thread; from there you can use
554      "Thread Next" to move down the thread.  This farm is in
555      latest-to-oldest order.
556    </para>
557
558       <itemizedlist>
559         <listitem>
560           <para>
561             Our threading expert Loren gives a breakdown of <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/ml/libstdc++/2001-10/msg00024.html">the
562             six situations involving threads</link> for the 3.0
563             release series.
564           </para>
565       </listitem>
566         <listitem>
567           <para>
568             <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/ml/libstdc++/2001-05/msg00384.html">
569         This message</link> inspired a recent updating of issues with
570         threading and the SGI STL library.  It also contains some
571         example POSIX-multithreaded STL code.
572           </para>
573         </listitem>
574       </itemizedlist>
575
576    <para>
577      (A large selection of links to older messages has been removed;
578      many of the messages from 1999 were lost in a disk crash, and the
579      few people with access to the backup tapes have been too swamped
580      with work to restore them.  Many of the points have been
581      superseded anyhow.)
582    </para>
583 </section>
584
585 </section>
586
587 <section xml:id="backwards.third"><info><title>Third</title></info>
588
589
590 <para> The third generation GNU C++ library is called libstdc++, or
591 libstdc++-v3.
592 </para>
593
594       <para>The subset commonly known as the Standard Template Library
595          (chapters 23 through 25, mostly) is adapted from the final release
596          of the SGI STL (version 3.3), with extensive changes.
597       </para>
598
599       <para>A more formal description of the V3 goals can be found in the
600          official <link linkend="contrib.design_notes">design document</link>.
601       </para>
602
603 <para>Portability notes and known implementation limitations are as follows.</para>
604
605 <section xml:id="backwards.third.headers"><info><title>Pre-ISO headers moved to backwards or removed</title></info>
606
607
608 <para> The pre-ISO C++ headers
609       (<filename class="headerfile">&lt;iostream.h&gt;</filename>,
610       <filename class="headerfile">&lt;defalloc.h&gt;</filename> etc.) are
611       available, unlike previous libstdc++ versions, but inclusion
612       generates a warning that you are using deprecated headers.
613 </para>
614
615     <para>This compatibility layer is constructed by including the
616     standard C++ headers, and injecting any items in
617     <code>std::</code> into the global namespace.
618    </para>
619    <para>For those of you new to ISO C++ (welcome, time travelers!), no,
620       that isn't a typo. Yes, the headers really have new names.
621       Marshall Cline's C++ FAQ Lite has a good explanation in <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.4">item
622       [27.4]</link>.
623    </para>
624
625 <para> Some include adjustment may be required. What follows is an
626 autoconf test that defines <code>PRE_STDCXX_HEADERS</code> when they
627 exist.</para>
628
629 <programlisting>
630 # AC_HEADER_PRE_STDCXX
631 AC_DEFUN([AC_HEADER_PRE_STDCXX], [
632   AC_CACHE_CHECK(for pre-ISO C++ include files,
633   ac_cv_cxx_pre_stdcxx,
634   [AC_LANG_SAVE
635   AC_LANG_CPLUSPLUS
636   ac_save_CXXFLAGS="$CXXFLAGS"
637   CXXFLAGS="$CXXFLAGS -Wno-deprecated"
638
639   # Omit defalloc.h, as compilation with newer compilers is problematic.
640   AC_TRY_COMPILE([
641   #include &lt;new.h&gt;
642   #include &lt;iterator.h&gt;
643   #include &lt;alloc.h&gt;
644   #include &lt;set.h&gt;
645   #include &lt;hashtable.h&gt;
646   #include &lt;hash_set.h&gt;
647   #include &lt;fstream.h&gt;
648   #include &lt;tempbuf.h&gt;
649   #include &lt;istream.h&gt;
650   #include &lt;bvector.h&gt;
651   #include &lt;stack.h&gt;
652   #include &lt;rope.h&gt;
653   #include &lt;complex.h&gt;
654   #include &lt;ostream.h&gt;
655   #include &lt;heap.h&gt;
656   #include &lt;iostream.h&gt;
657   #include &lt;function.h&gt;
658   #include &lt;multimap.h&gt;
659   #include &lt;pair.h&gt;
660   #include &lt;stream.h&gt;
661   #include &lt;iomanip.h&gt;
662   #include &lt;slist.h&gt;
663   #include &lt;tree.h&gt;
664   #include &lt;vector.h&gt;
665   #include &lt;deque.h&gt;
666   #include &lt;multiset.h&gt;
667   #include &lt;list.h&gt;
668   #include &lt;map.h&gt;
669   #include &lt;algobase.h&gt;
670   #include &lt;hash_map.h&gt;
671   #include &lt;algo.h&gt;
672   #include &lt;queue.h&gt;
673   #include &lt;streambuf.h&gt;
674   ],,
675   ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
676   CXXFLAGS="$ac_save_CXXFLAGS"
677   AC_LANG_RESTORE
678   ])
679   if test "$ac_cv_cxx_pre_stdcxx" = yes; then
680     AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
681   fi
682 ])
683 </programlisting>
684
685 <para>Porting between pre-ISO headers and ISO headers is simple: headers
686 like <filename class="headerfile">&lt;vector.h&gt;</filename> can be replaced with <filename class="headerfile">&lt;vector&gt;</filename> and a using
687 directive <code>using namespace std;</code> can be put at the global
688 scope. This should be enough to get this code compiling, assuming the
689 other usage is correct.
690 </para>
691 </section>
692
693 <section xml:id="backwards.third.hash"><info><title>Extension headers hash_map, hash_set moved to ext or backwards</title></info>
694
695
696       <para>At this time most of the features of the SGI STL extension have been
697          replaced by standardized libraries.
698          In particular, the <classname>unordered_map</classname> and
699          <classname>unordered_set</classname> containers of TR1 and C++ 2011
700          are suitable replacements for the non-standard
701          <classname>hash_map</classname> and <classname>hash_set</classname>
702          containers in the SGI STL.
703       </para>
704 <para> Header files <filename class="headerfile">&lt;hash_map&gt;</filename> and <filename class="headerfile">&lt;hash_set&gt;</filename> moved
705 to <filename class="headerfile">&lt;ext/hash_map&gt;</filename> and  <filename class="headerfile">&lt;ext/hash_set&gt;</filename>,
706 respectively. At the same time, all types in these files are enclosed
707 in <code>namespace __gnu_cxx</code>. Later versions deprecate
708 these files, and suggest using TR1's  <filename class="headerfile">&lt;unordered_map&gt;</filename>
709 and  <filename class="headerfile">&lt;unordered_set&gt;</filename> instead.
710 </para>
711
712       <para>The extensions are no longer in the global or <code>std</code>
713          namespaces, instead they are declared in the <code>__gnu_cxx</code>
714          namespace. For maximum portability, consider defining a namespace
715          alias to use to talk about extensions, e.g.:
716       </para>
717       <programlisting>
718       #ifdef __GNUC__
719       #if __GNUC__ &lt; 3
720         #include &lt;hash_map.h&gt;
721         namespace extension { using ::hash_map; }; // inherit globals
722       #else
723         #include &lt;backward/hash_map&gt;
724         #if __GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ == 0
725           namespace extension = std;               // GCC 3.0
726         #else
727           namespace extension = ::__gnu_cxx;       // GCC 3.1 and later
728         #endif
729       #endif
730       #else      // ...  there are other compilers, right?
731         namespace extension = std;
732       #endif
733
734       extension::hash_map&lt;int,int&gt; my_map;
735       </programlisting>
736       <para>This is a bit cleaner than defining typedefs for all the
737          instantiations you might need.
738       </para>
739
740
741 <para>The following autoconf tests check for working HP/SGI hash containers.
742 </para>
743
744 <programlisting>
745 # AC_HEADER_EXT_HASH_MAP
746 AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
747   AC_CACHE_CHECK(for ext/hash_map,
748   ac_cv_cxx_ext_hash_map,
749   [AC_LANG_SAVE
750   AC_LANG_CPLUSPLUS
751   ac_save_CXXFLAGS="$CXXFLAGS"
752   CXXFLAGS="$CXXFLAGS -Werror"
753   AC_TRY_COMPILE([#include &lt;ext/hash_map&gt;], [using __gnu_cxx::hash_map;],
754   ac_cv_cxx_ext_hash_map=yes, ac_cv_cxx_ext_hash_map=no)
755   CXXFLAGS="$ac_save_CXXFLAGS"
756   AC_LANG_RESTORE
757   ])
758   if test "$ac_cv_cxx_ext_hash_map" = yes; then
759     AC_DEFINE(HAVE_EXT_HASH_MAP,,[Define if ext/hash_map is present. ])
760   fi
761 ])
762 </programlisting>
763
764 <programlisting>
765 # AC_HEADER_EXT_HASH_SET
766 AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
767   AC_CACHE_CHECK(for ext/hash_set,
768   ac_cv_cxx_ext_hash_set,
769   [AC_LANG_SAVE
770   AC_LANG_CPLUSPLUS
771   ac_save_CXXFLAGS="$CXXFLAGS"
772   CXXFLAGS="$CXXFLAGS -Werror"
773   AC_TRY_COMPILE([#include &lt;ext/hash_set&gt;], [using __gnu_cxx::hash_set;],
774   ac_cv_cxx_ext_hash_set=yes, ac_cv_cxx_ext_hash_set=no)
775   CXXFLAGS="$ac_save_CXXFLAGS"
776   AC_LANG_RESTORE
777   ])
778   if test "$ac_cv_cxx_ext_hash_set" = yes; then
779     AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
780   fi
781 ])
782 </programlisting>
783 </section>
784
785 <section xml:id="backwards.third.nocreate_noreplace"><info><title>No <code>ios::nocreate/ios::noreplace</code>.
786 </title></info>
787
788
789 <para> The existence of <code>ios::nocreate</code> being used for
790 input-streams has been confirmed, most probably because the author
791 thought it would be more correct to specify nocreate explicitly.  So
792 it can be left out for input-streams.
793 </para>
794
795 <para>For output streams, <quote>nocreate</quote> is probably the default,
796 unless you specify <code>std::ios::trunc</code> ? To be safe, you can
797 open the file for reading, check if it has been opened, and then
798 decide whether you want to create/replace or not. To my knowledge,
799 even older implementations support <code>app</code>, <code>ate</code>
800 and <code>trunc</code> (except for <code>app</code> ?).
801 </para>
802 </section>
803
804 <section xml:id="backwards.third.streamattach"><info><title>
805 No <code>stream::attach(int fd)</code>
806 </title></info>
807
808
809 <para>
810       Phil Edwards writes: It was considered and rejected for the ISO
811       standard.  Not all environments use file descriptors.  Of those
812       that do, not all of them use integers to represent them.
813     </para>
814
815 <para>
816       For a portable solution (among systems which use
817       file descriptors), you need to implement a subclass of
818       <code>std::streambuf</code> (or
819       <code>std::basic_streambuf&lt;..&gt;</code>) which opens a file
820       given a descriptor, and then pass an instance of this to the
821       stream-constructor.
822     </para>
823
824 <para>
825       An extension is available that implements this.
826       <filename class="headerfile">&lt;ext/stdio_filebuf.h&gt;</filename> contains a derived class called
827       <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00074.html"><code>__gnu_cxx::stdio_filebuf</code></link>.
828       This class can be constructed from a C <code>FILE*</code> or a file
829       descriptor, and provides the <code>fd()</code> function.
830     </para>
831
832 <para>
833  For another example of this, refer to
834       <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.josuttis.com/cppcode/fdstream.html">fdstream example</link>
835       by Nicolai Josuttis.
836 </para>
837 </section>
838
839 <section xml:id="backwards.third.support_cxx98"><info><title>
840 Support for C++98 dialect.
841 </title></info>
842
843
844 <para>Check for complete library coverage of the C++1998/2003 standard.
845 </para>
846
847 <programlisting>
848 # AC_HEADER_STDCXX_98
849 AC_DEFUN([AC_HEADER_STDCXX_98], [
850   AC_CACHE_CHECK(for ISO C++ 98 include files,
851   ac_cv_cxx_stdcxx_98,
852   [AC_LANG_SAVE
853   AC_LANG_CPLUSPLUS
854   AC_TRY_COMPILE([
855     #include &lt;cassert&gt;
856     #include &lt;cctype&gt;
857     #include &lt;cerrno&gt;
858     #include &lt;cfloat&gt;
859     #include &lt;ciso646&gt;
860     #include &lt;climits&gt;
861     #include &lt;clocale&gt;
862     #include &lt;cmath&gt;
863     #include &lt;csetjmp&gt;
864     #include &lt;csignal&gt;
865     #include &lt;cstdarg&gt;
866     #include &lt;cstddef&gt;
867     #include &lt;cstdio&gt;
868     #include &lt;cstdlib&gt;
869     #include &lt;cstring&gt;
870     #include &lt;ctime&gt;
871
872     #include &lt;algorithm&gt;
873     #include &lt;bitset&gt;
874     #include &lt;complex&gt;
875     #include &lt;deque&gt;
876     #include &lt;exception&gt;
877     #include &lt;fstream&gt;
878     #include &lt;functional&gt;
879     #include &lt;iomanip&gt;
880     #include &lt;ios&gt;
881     #include &lt;iosfwd&gt;
882     #include &lt;iostream&gt;
883     #include &lt;istream&gt;
884     #include &lt;iterator&gt;
885     #include &lt;limits&gt;
886     #include &lt;list&gt;
887     #include &lt;locale&gt;
888     #include &lt;map&gt;
889     #include &lt;memory&gt;
890     #include &lt;new&gt;
891     #include &lt;numeric&gt;
892     #include &lt;ostream&gt;
893     #include &lt;queue&gt;
894     #include &lt;set&gt;
895     #include &lt;sstream&gt;
896     #include &lt;stack&gt;
897     #include &lt;stdexcept&gt;
898     #include &lt;streambuf&gt;
899     #include &lt;string&gt;
900     #include &lt;typeinfo&gt;
901     #include &lt;utility&gt;
902     #include &lt;valarray&gt;
903     #include &lt;vector&gt;
904   ],,
905   ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
906   AC_LANG_RESTORE
907   ])
908   if test "$ac_cv_cxx_stdcxx_98" = yes; then
909     AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
910   fi
911 ])
912 </programlisting>
913 </section>
914
915 <section xml:id="backwards.third.support_tr1"><info><title>
916 Support for C++TR1 dialect.
917 </title></info>
918
919
920 <para>Check for library coverage of the TR1 standard.
921 </para>
922
923 <programlisting>
924 # AC_HEADER_STDCXX_TR1
925 AC_DEFUN([AC_HEADER_STDCXX_TR1], [
926   AC_CACHE_CHECK(for ISO C++ TR1 include files,
927   ac_cv_cxx_stdcxx_tr1,
928   [AC_LANG_SAVE
929   AC_LANG_CPLUSPLUS
930   AC_TRY_COMPILE([
931   #include &lt;tr1/array&gt;
932   #include &lt;tr1/ccomplex&gt;
933   #include &lt;tr1/cctype&gt;
934   #include &lt;tr1/cfenv&gt;
935   #include &lt;tr1/cfloat&gt;
936   #include &lt;tr1/cinttypes&gt;
937   #include &lt;tr1/climits&gt;
938   #include &lt;tr1/cmath&gt;
939   #include &lt;tr1/complex&gt;
940   #include &lt;tr1/cstdarg&gt;
941   #include &lt;tr1/cstdbool&gt;
942   #include &lt;tr1/cstdint&gt;
943   #include &lt;tr1/cstdio&gt;
944   #include &lt;tr1/cstdlib&gt;
945   #include &lt;tr1/ctgmath&gt;
946   #include &lt;tr1/ctime&gt;
947   #include &lt;tr1/cwchar&gt;
948   #include &lt;tr1/cwctype&gt;
949   #include &lt;tr1/functional&gt;
950   #include &lt;tr1/memory&gt;
951   #include &lt;tr1/random&gt;
952   #include &lt;tr1/regex&gt;
953   #include &lt;tr1/tuple&gt;
954   #include &lt;tr1/type_traits&gt;
955   #include &lt;tr1/unordered_set&gt;
956   #include &lt;tr1/unordered_map&gt;
957   #include &lt;tr1/utility&gt;
958   ],,
959   ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
960   AC_LANG_RESTORE
961   ])
962   if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
963     AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
964   fi
965 ])
966 </programlisting>
967
968 <para>An alternative is to check just for specific TR1 includes, such as &lt;unordered_map&gt; and &lt;unordered_set&gt;.
969 </para>
970
971 <programlisting>
972 # AC_HEADER_TR1_UNORDERED_MAP
973 AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
974   AC_CACHE_CHECK(for tr1/unordered_map,
975   ac_cv_cxx_tr1_unordered_map,
976   [AC_LANG_SAVE
977   AC_LANG_CPLUSPLUS
978   AC_TRY_COMPILE([#include &lt;tr1/unordered_map&gt;], [using std::tr1::unordered_map;],
979   ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
980   AC_LANG_RESTORE
981   ])
982   if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
983     AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
984   fi
985 ])
986 </programlisting>
987
988 <programlisting>
989 # AC_HEADER_TR1_UNORDERED_SET
990 AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
991   AC_CACHE_CHECK(for tr1/unordered_set,
992   ac_cv_cxx_tr1_unordered_set,
993   [AC_LANG_SAVE
994   AC_LANG_CPLUSPLUS
995   AC_TRY_COMPILE([#include &lt;tr1/unordered_set&gt;], [using std::tr1::unordered_set;],
996   ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
997   AC_LANG_RESTORE
998   ])
999   if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
1000     AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
1001   fi
1002 ])
1003 </programlisting>
1004 </section>
1005
1006
1007 <section xml:id="backwards.third.support_cxx11"><info><title>
1008 Support for C++11 dialect.
1009 </title></info>
1010
1011
1012 <para>Check for baseline language coverage in the compiler for the C++11 standard.
1013 </para>
1014
1015 <programlisting>
1016 # AC_COMPILE_STDCXX_11
1017 AC_DEFUN([AC_COMPILE_STDCXX_11], [
1018   AC_CACHE_CHECK(if g++ supports C++11 features without additional flags,
1019   ac_cv_cxx_compile_cxx11_native,
1020   [AC_LANG_SAVE
1021   AC_LANG_CPLUSPLUS
1022   AC_TRY_COMPILE([
1023   template &lt;typename T&gt;
1024     struct check final
1025     {
1026       static constexpr T value{ __cplusplus };
1027     };
1028
1029     typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
1030
1031     int a;
1032     decltype(a) b;
1033
1034     typedef check&lt;int&gt; check_type;
1035     check_type c{};
1036     check_type&amp;&amp; cr = static_cast&lt;check_type&amp;&amp;&gt;(c);
1037
1038     static_assert(check_type::value == 201103L, "C++11 compiler");],,
1039   ac_cv_cxx_compile_cxx11_native=yes, ac_cv_cxx_compile_cxx11_native=no)
1040   AC_LANG_RESTORE
1041   ])
1042
1043   AC_CACHE_CHECK(if g++ supports C++11 features with -std=c++11,
1044   ac_cv_cxx_compile_cxx11_cxx,
1045   [AC_LANG_SAVE
1046   AC_LANG_CPLUSPLUS
1047   ac_save_CXXFLAGS="$CXXFLAGS"
1048   CXXFLAGS="$CXXFLAGS -std=c++11"
1049   AC_TRY_COMPILE([
1050   template &lt;typename T&gt;
1051     struct check final
1052     {
1053       static constexpr T value{ __cplusplus };
1054     };
1055
1056     typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
1057
1058     int a;
1059     decltype(a) b;
1060
1061     typedef check&lt;int&gt; check_type;
1062     check_type c{};
1063     check_type&amp;&amp; cr = static_cast&lt;check_type&amp;&amp;&gt;(c);
1064
1065     static_assert(check_type::value == 201103L, "C++11 compiler");],,
1066   ac_cv_cxx_compile_cxx11_cxx=yes, ac_cv_cxx_compile_cxx11_cxx=no)
1067   CXXFLAGS="$ac_save_CXXFLAGS"
1068   AC_LANG_RESTORE
1069   ])
1070
1071   AC_CACHE_CHECK(if g++ supports C++11 features with -std=gnu++11,
1072   ac_cv_cxx_compile_cxx11_gxx,
1073   [AC_LANG_SAVE
1074   AC_LANG_CPLUSPLUS
1075   ac_save_CXXFLAGS="$CXXFLAGS"
1076   CXXFLAGS="$CXXFLAGS -std=gnu++11"
1077   AC_TRY_COMPILE([
1078   template &lt;typename T&gt;
1079     struct check final
1080     {
1081       static constexpr T value{ __cplusplus };
1082     };
1083
1084     typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
1085
1086     int a;
1087     decltype(a) b;
1088
1089     typedef check&lt;int&gt; check_type;
1090     check_type c{};
1091     check_type&amp;&amp; cr = static_cast&lt;check_type&amp;&amp;&gt;(c);
1092
1093     static_assert(check_type::value == 201103L, "C++11 compiler");],,
1094   ac_cv_cxx_compile_cxx11_gxx=yes, ac_cv_cxx_compile_cxx11_gxx=no)
1095   CXXFLAGS="$ac_save_CXXFLAGS"
1096   AC_LANG_RESTORE
1097   ])
1098
1099   if test "$ac_cv_cxx_compile_cxx11_native" = yes ||
1100      test "$ac_cv_cxx_compile_cxx11_cxx" = yes ||
1101      test "$ac_cv_cxx_compile_cxx11_gxx" = yes; then
1102     AC_DEFINE(HAVE_STDCXX_11,,[Define if g++ supports C++11 features. ])
1103   fi
1104 ])
1105 </programlisting>
1106
1107
1108 <para>Check for library coverage of the C++2011 standard.
1109   (Some library headers are commented out in this check, they are
1110   not currently provided by libstdc++).
1111 </para>
1112
1113 <programlisting>
1114 # AC_HEADER_STDCXX_11
1115 AC_DEFUN([AC_HEADER_STDCXX_11], [
1116   AC_CACHE_CHECK(for ISO C++11 include files,
1117   ac_cv_cxx_stdcxx_11,
1118   [AC_REQUIRE([AC_COMPILE_STDCXX_11])
1119   AC_LANG_SAVE
1120   AC_LANG_CPLUSPLUS
1121   ac_save_CXXFLAGS="$CXXFLAGS"
1122   CXXFLAGS="$CXXFLAGS -std=gnu++11"
1123
1124   AC_TRY_COMPILE([
1125     #include &lt;cassert&gt;
1126     #include &lt;ccomplex&gt;
1127     #include &lt;cctype&gt;
1128     #include &lt;cerrno&gt;
1129     #include &lt;cfenv&gt;
1130     #include &lt;cfloat&gt;
1131     #include &lt;cinttypes&gt;
1132     #include &lt;ciso646&gt;
1133     #include &lt;climits&gt;
1134     #include &lt;clocale&gt;
1135     #include &lt;cmath&gt;
1136     #include &lt;csetjmp&gt;
1137     #include &lt;csignal&gt;
1138     #include &lt;cstdalign&gt;
1139     #include &lt;cstdarg&gt;
1140     #include &lt;cstdbool&gt;
1141     #include &lt;cstddef&gt;
1142     #include &lt;cstdint&gt;
1143     #include &lt;cstdio&gt;
1144     #include &lt;cstdlib&gt;
1145     #include &lt;cstring&gt;
1146     #include &lt;ctgmath&gt;
1147     #include &lt;ctime&gt;
1148     // #include &lt;cuchar&gt;
1149     #include &lt;cwchar&gt;
1150     #include &lt;cwctype&gt;
1151
1152     #include &lt;algorithm&gt;
1153     #include &lt;array&gt;
1154     #include &lt;atomic&gt;
1155     #include &lt;bitset&gt;
1156     #include &lt;chrono&gt;
1157     // #include &lt;codecvt&gt;
1158     #include &lt;complex&gt;
1159     #include &lt;condition_variable&gt;
1160     #include &lt;deque&gt;
1161     #include &lt;exception&gt;
1162     #include &lt;forward_list&gt;
1163     #include &lt;fstream&gt;
1164     #include &lt;functional&gt;
1165     #include &lt;future&gt;
1166     #include &lt;initializer_list&gt;
1167     #include &lt;iomanip&gt;
1168     #include &lt;ios&gt;
1169     #include &lt;iosfwd&gt;
1170     #include &lt;iostream&gt;
1171     #include &lt;istream&gt;
1172     #include &lt;iterator&gt;
1173     #include &lt;limits&gt;
1174     #include &lt;list&gt;
1175     #include &lt;locale&gt;
1176     #include &lt;map&gt;
1177     #include &lt;memory&gt;
1178     #include &lt;mutex&gt;
1179     #include &lt;new&gt;
1180     #include &lt;numeric&gt;
1181     #include &lt;ostream&gt;
1182     #include &lt;queue&gt;
1183     #include &lt;random&gt;
1184     #include &lt;ratio&gt;
1185     #include &lt;regex&gt;
1186     #include &lt;scoped_allocator&gt;
1187     #include &lt;set&gt;
1188     #include &lt;sstream&gt;
1189     #include &lt;stack&gt;
1190     #include &lt;stdexcept&gt;
1191     #include &lt;streambuf&gt;
1192     #include &lt;string&gt;
1193     #include &lt;system_error&gt;
1194     #include &lt;thread&gt;
1195     #include &lt;tuple&gt;
1196     #include &lt;typeindex&gt;
1197     #include &lt;typeinfo&gt;
1198     #include &lt;type_traits&gt;
1199     #include &lt;unordered_map&gt;
1200     #include &lt;unordered_set&gt;
1201     #include &lt;utility&gt;
1202     #include &lt;valarray&gt;
1203     #include &lt;vector&gt;
1204   ],,
1205   ac_cv_cxx_stdcxx_11=yes, ac_cv_cxx_stdcxx_11=no)
1206   AC_LANG_RESTORE
1207   CXXFLAGS="$ac_save_CXXFLAGS"
1208   ])
1209   if test "$ac_cv_cxx_stdcxx_11" = yes; then
1210     AC_DEFINE(STDCXX_11_HEADERS,,[Define if ISO C++11 header files are present. ])
1211   fi
1212 ])
1213 </programlisting>
1214
1215 <para>As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For
1216 <filename class="headerfile">&lt;unordered_map&gt;</filename>
1217 </para>
1218
1219 <programlisting>
1220 # AC_HEADER_UNORDERED_MAP
1221 AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
1222   AC_CACHE_CHECK(for unordered_map,
1223   ac_cv_cxx_unordered_map,
1224   [AC_REQUIRE([AC_COMPILE_STDCXX_11])
1225   AC_LANG_SAVE
1226   AC_LANG_CPLUSPLUS
1227   ac_save_CXXFLAGS="$CXXFLAGS"
1228   CXXFLAGS="$CXXFLAGS -std=gnu++11"
1229   AC_TRY_COMPILE([#include &lt;unordered_map&gt;], [using std::unordered_map;],
1230   ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
1231   CXXFLAGS="$ac_save_CXXFLAGS"
1232   AC_LANG_RESTORE
1233   ])
1234   if test "$ac_cv_cxx_unordered_map" = yes; then
1235     AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
1236   fi
1237 ])
1238 </programlisting>
1239
1240 <programlisting>
1241 # AC_HEADER_UNORDERED_SET
1242 AC_DEFUN([AC_HEADER_UNORDERED_SET], [
1243   AC_CACHE_CHECK(for unordered_set,
1244   ac_cv_cxx_unordered_set,
1245   [AC_REQUIRE([AC_COMPILE_STDCXX_11])
1246   AC_LANG_SAVE
1247   AC_LANG_CPLUSPLUS
1248   ac_save_CXXFLAGS="$CXXFLAGS"
1249   CXXFLAGS="$CXXFLAGS -std=gnu++11"
1250   AC_TRY_COMPILE([#include &lt;unordered_set&gt;], [using std::unordered_set;],
1251   ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
1252   CXXFLAGS="$ac_save_CXXFLAGS"
1253   AC_LANG_RESTORE
1254   ])
1255   if test "$ac_cv_cxx_unordered_set" = yes; then
1256     AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
1257   fi
1258 ])
1259 </programlisting>
1260
1261 <para>
1262   Some C++11 features first appeared in GCC 4.3 and could be enabled by
1263   <option>-std=c++0x</option> and <option>-std=gnu++0x</option> for GCC
1264   releases which pre-date the 2011 standard. Those C++11 features and GCC's
1265   support for them were still changing until the 2011 standard was finished,
1266   but the autoconf checks above could be extended to test for incomplete
1267   C++11 support with <option>-std=c++0x</option> and
1268   <option>-std=gnu++0x</option>.
1269 </para>
1270
1271 </section>
1272
1273 <section xml:id="backwards.third.iterator_type"><info><title>
1274   <code>Container::iterator_type</code> is not necessarily <code>Container::value_type*</code>
1275 </title></info>
1276
1277
1278 <para>
1279   This is a change in behavior from older versions. Now, most
1280   <type>iterator_type</type> typedefs in container classes are POD
1281   objects, not <type>value_type</type> pointers.
1282 </para>
1283 </section>
1284
1285 </section>
1286
1287 <bibliography xml:id="backwards.biblio"><info><title>Bibliography</title></info>
1288
1289
1290   <biblioentry>
1291       <title>
1292         <link xmlns:xlink="http://www.w3.org/1999/xlink"
1293               xlink:href="http://www.kegel.com/gcc/gcc4.html">
1294       Migrating to GCC 4.1
1295         </link>
1296       </title>
1297
1298     <author><personname><firstname>Dan</firstname><surname>Kegel</surname></personname></author>
1299   </biblioentry>
1300
1301   <biblioentry>
1302       <title>
1303         <link xmlns:xlink="http://www.w3.org/1999/xlink"
1304               xlink:href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html">
1305       Building the Whole Debian Archive with GCC 4.1: A Summary
1306         </link>
1307       </title>
1308     <author><personname><firstname>Martin</firstname><surname>Michlmayr</surname></personname></author>
1309   </biblioentry>
1310
1311   <biblioentry>
1312       <title>
1313         <link xmlns:xlink="http://www.w3.org/1999/xlink"
1314               xlink:href="http://annwm.lbl.gov/~leggett/Atlas/gcc-3.2.html">
1315       Migration guide for GCC-3.2
1316         </link>
1317       </title>
1318
1319   </biblioentry>
1320
1321 </bibliography>
1322
1323 </section>