OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [doc/] [html/] [manual/] [backwards.html] - Blame information for rev 424

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Backwards Compatibility</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      backwards&#10;    " /><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="appendix_porting.html" title="Appendix B.  Porting and Maintenance" /><link rel="prev" href="api.html" title="API Evolution and Deprecation History" /><link rel="next" href="appendix_free.html" title="Appendix C.  Free Software Needs Free Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Backwards Compatibility</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center">Appendix B. 
4
  Porting and Maintenance
5
 
6
</th><td width="20%" align="right"> <a accesskey="n" href="appendix_free.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Backwards Compatibility"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.appendix.porting.backwards"></a>Backwards Compatibility</h2></div></div></div><div class="sect2" title="First"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.first"></a>First</h3></div></div></div><p>The first generation GNU C++ library was called libg++.  It was a
7
separate GNU project, although reliably paired with GCC. Rumors imply
8
that it had a working relationship with at least two kinds of
9
dinosaur.
10
</p><p>Some background: libg++ was designed and created when there was no
11
ISO standard to provide guidance.  Classes like linked lists are now
12
provided for by <code class="classname">list&lt;T&gt;</code> and do not need to be
13
created by <code class="function">genclass</code>.  (For that matter, templates exist
14
now and are well-supported, whereas genclass (mostly) predates them.)
15
</p><p>There are other classes in libg++ that are not specified in the
16
ISO Standard (e.g., statistical analysis).  While there are a lot of
17
really useful things that are used by a lot of people, the Standards
18
Committee couldn't include everything, and so a lot of those
19
<span class="quote">“<span class="quote">obvious</span>”</span> classes didn't get included.
20
</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="No ios_base"><div class="titlepage"><div><div><h4 class="title"><a id="id646429"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>.
21
</p></div><div class="sect3" title="No cout in ostream.h, no cin in istream.h"><div class="titlepage"><div><div><h4 class="title"><a id="id646461"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p>
22
        In earlier versions of the standard,
23
        <code class="filename">fstream.h</code>,
24
        <code class="filename">ostream.h</code>
25
        and <code class="filename">istream.h</code>
26
        used to define
27
        <code class="code">cout</code>, <code class="code">cin</code> and so on. ISO C++ specifies that one needs to include
28
        <code class="filename">iostream</code>
29
        explicitly to get the required definitions.
30
 </p><p> Some include adjustment may be required.</p><p>This project is no longer maintained or supported, and the sources
31
archived. For the desperate,
32
the <a class="ulink" href="http://gcc.gnu.org/extensions.html" target="_top">GCC extensions
33
page</a> describes where to find the last libg++ source. The code is
34
considered replaced and rewritten.
35
</p></div></div><div class="sect2" title="Second"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.second"></a>Second</h3></div></div></div><p>
36
  The second generation GNU C++ library was called libstdc++, or
37
  libstdc++-v2. It spans the time between libg++ and pre-ISO C++
38
  standardization and is usually associated with the following GCC
39
  releases: egcs 1.x, gcc 2.95, and gcc 2.96.
40
</p><p>
41
  The STL portions of this library are based on SGI/HP STL release 3.11.
42
</p><p>
43
  This project is no longer maintained or supported, and the sources
44
  archived.  The code is considered replaced and rewritten.
45
</p><p>
46
  Portability notes and known implementation limitations are as follows.
47
</p><div class="sect3" title="Namespace std:: not supported"><div class="titlepage"><div><div><h4 class="title"><a id="id646559"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p>
48
    Some care is required to support C++ compiler and or library
49
    implementation that do not have the standard library in
50
    <code class="code">namespace std</code>.
51
  </p><p>
52
    The following sections list some possible solutions to support compilers
53
    that cannot ignore <code class="code">std::</code>-qualified names.
54
  </p><p>
55
    First, see if the compiler has a flag for this. Namespace
56
    back-portability-issues are generally not a problem for g++
57
    compilers that do not have libstdc++ in <code class="code">std::</code>, as the
58
    compilers use <code class="code">-fno-honor-std</code> (ignore
59
    <code class="code">std::</code>, <code class="code">:: = std::</code>) by default. That is,
60
    the responsibility for enabling or disabling <code class="code">std::</code> is
61
    on the user; the maintainer does not have to care about it. This
62
    probably applies to some other compilers as well.
63
  </p><p>
64
    Second, experiment with a variety of pre-processor tricks.
65
  </p><p>
66
    By defining <code class="code">std</code> as a macro, fully-qualified namespace
67
    calls become global. Volia.
68
  </p><pre class="programlisting">
69
#ifdef WICKEDLY_OLD_COMPILER
70
# define std
71
#endif
72
</pre><p>
73
    Thanks to Juergen Heinzl who posted this solution on gnu.gcc.help.
74
  </p><p>
75
    Another pre-processor based approach is to define a macro
76
    <code class="code">NAMESPACE_STD</code>, which is defined to either
77
    <span class="quote">“<span class="quote"> </span>”</span> or <span class="quote">“<span class="quote">std</span>”</span> based on a compile-type
78
    test. On GNU systems, this can be done with autotools by means of
79
    an autoconf test (see below) for <code class="code">HAVE_NAMESPACE_STD</code>,
80
    then using that to set a value for the <code class="code">NAMESPACE_STD</code>
81
    macro.  At that point, one is able to use
82
    <code class="code">NAMESPACE_STD::string</code>, which will evaluate to
83
    <code class="code">std::string</code> or <code class="code">::string</code> (i.e., in the
84
    global namespace on systems that do not put <code class="code">string</code> in
85
    <code class="code">std::</code>).
86
  </p><pre class="programlisting">
87
dnl @synopsis AC_CXX_NAMESPACE_STD
88
dnl
89
dnl If the compiler supports namespace std, define
90
dnl HAVE_NAMESPACE_STD.
91
dnl
92
dnl @category Cxx
93
dnl @author Todd Veldhuizen
94
dnl @author Luc Maisonobe &lt;luc@spaceroots.org&gt;
95
dnl @version 2004-02-04
96
dnl @license AllPermissive
97
AC_DEFUN([AC_CXX_NAMESPACE_STD], [
98
  AC_CACHE_CHECK(if g++ supports namespace std,
99
  ac_cv_cxx_have_std_namespace,
100
  [AC_LANG_SAVE
101
  AC_LANG_CPLUSPLUS
102
  AC_TRY_COMPILE([#include &lt;iostream&gt;
103
                  std::istream&amp; is = std::cin;],,
104
  ac_cv_cxx_have_std_namespace=yes, ac_cv_cxx_have_std_namespace=no)
105
  AC_LANG_RESTORE
106
  ])
107
  if test "$ac_cv_cxx_have_std_namespace" = yes; then
108
    AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
109
  fi
110
])
111
</pre></div><div class="sect3" title="Illegal iterator usage"><div class="titlepage"><div><div><h4 class="title"><a id="id699742"></a>Illegal iterator usage</h4></div></div></div><p>
112
  The following illustrate implementation-allowed illegal iterator
113
  use, and then correct use.
114
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
115
      you cannot do <code class="code">ostream::operator&lt;&lt;(iterator)</code>
116
      to print the address of the iterator =&gt; use
117
      <code class="code">operator&lt;&lt; &amp;*iterator</code> instead
118
    </p></li><li class="listitem"><p>
119
      you cannot clear an iterator's reference (<code class="code">iterator =
120
      0</code>) =&gt; use <code class="code">iterator = iterator_type();</code>
121
    </p></li><li class="listitem"><p>
122
      <code class="code">if (iterator)</code> won't work any more =&gt; use
123
      <code class="code">if (iterator != iterator_type())</code>
124
    </p></li></ul></div></div><div class="sect3" title="isspace from cctype is a macro"><div class="titlepage"><div><div><h4 class="title"><a id="id699804"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro
125
  </h4></div></div></div><p>
126
    Glibc 2.0.x and 2.1.x define <code class="filename">ctype.h</code> functionality as macros
127
    (isspace, isalpha etc.).
128
  </p><p>
129
    This implementations of libstdc++, however, keep these functions
130
    as macros, and so it is not back-portable to use fully qualified
131
    names. For example:
132
  </p><pre class="programlisting">
133
#include &lt;cctype&gt;
134
int main() { std::isspace('X'); }
135
</pre><p>
136
  Results in something like this:
137
</p><pre class="programlisting">
138
std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int) _ISspace ) ;
139
</pre><p>
140
  A solution is to modify a header-file so that the compiler tells
141
  <code class="filename">ctype.h</code> to define functions
142
  instead of macros:
143
</p><pre class="programlisting">
144
// This keeps isalnum, et al from being propagated as macros.
145
#if __linux__
146
# define __NO_CTYPE 1
147
#endif
148
</pre><p>
149
  Then, include <code class="filename">ctype.h</code>
150
</p><p>
151
  Another problem arises if you put a <code class="code">using namespace
152
  std;</code> declaration at the top, and include <code class="filename">ctype.h</code>. This will result in
153
  ambiguities between the definitions in the global namespace
154
  (<code class="filename">ctype.h</code>) and the
155
  definitions in namespace <code class="code">std::</code>
156
  (<code class="code">&lt;cctype&gt;</code>).
157
</p></div><div class="sect3" title="No vector::at, deque::at, string::at"><div class="titlepage"><div><div><h4 class="title"><a id="id699897"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p>
158
  One solution is to add an autoconf-test for this:
159
</p><pre class="programlisting">
160
AC_MSG_CHECKING(for container::at)
161
AC_TRY_COMPILE(
162
[
163
#include &lt;vector&gt;
164
#include &lt;deque&gt;
165
#include &lt;string&gt;
166
 
167
using namespace std;
168
],
169
[
170
deque&lt;int&gt; test_deque(3);
171
test_deque.at(2);
172
vector&lt;int&gt; test_vector(2);
173
test_vector.at(1);
174
string test_string(<span class="quote">“<span class="quote">test_string</span>”</span>);
175
test_string.at(3);
176
],
177
[AC_MSG_RESULT(yes)
178
AC_DEFINE(HAVE_CONTAINER_AT)],
179
[AC_MSG_RESULT(no)])
180
</pre><p>
181
  If you are using other (non-GNU) compilers it might be a good idea
182
  to check for <code class="code">string::at</code> separately.
183
</p></div><div class="sect3" title="No std::char_traits&lt;char&gt;::eof"><div class="titlepage"><div><div><h4 class="title"><a id="id716937"></a>No <code class="code">std::char_traits&lt;char&gt;::eof</code></h4></div></div></div><p>
184
  Use some kind of autoconf test, plus this:
185
</p><pre class="programlisting">
186
#ifdef HAVE_CHAR_TRAITS
187
#define CPP_EOF std::char_traits&lt;char&gt;::eof()
188
#else
189
#define CPP_EOF EOF
190
#endif
191
</pre></div><div class="sect3" title="No string::clear"><div class="titlepage"><div><div><h4 class="title"><a id="id716955"></a>No <code class="code">string::clear</code></h4></div></div></div><p>
192
  There are two functions for deleting the contents of a string:
193
  <code class="code">clear</code> and <code class="code">erase</code> (the latter returns the
194
  string).
195
</p><pre class="programlisting">
196
void
197
clear() { _M_mutate(0, this-&gt;size(), 0); }
198
</pre><pre class="programlisting">
199
basic_string&amp;
200
erase(size_type __pos = 0, size_type __n = npos)
201
{
202
  return this-&gt;replace(_M_check(__pos), _M_fold(__pos, __n),
203
                          _M_data(), _M_data());
204
}
205
</pre><p>
206
  Unfortunately, <code class="code">clear</code> is not implemented in this
207
  version, so you should use <code class="code">erase</code> (which is probably
208
  faster than <code class="code">operator=(charT*)</code>).
209
</p></div><div class="sect3" title="Removal of ostream::form and istream::scan extensions"><div class="titlepage"><div><div><h4 class="title"><a id="id717001"></a>
210
  Removal of <code class="code">ostream::form</code> and <code class="code">istream::scan</code>
211
  extensions
212
</h4></div></div></div><p>
213
  These are no longer supported. Please use stringstreams instead.
214
</p></div><div class="sect3" title="No basic_stringbuf, basic_stringstream"><div class="titlepage"><div><div><h4 class="title"><a id="id717020"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p>
215
  Although the ISO standard <code class="code">i/ostringstream</code>-classes are
216
  provided, (<code class="filename">sstream</code>), for
217
  compatibility with older implementations the pre-ISO
218
  <code class="code">i/ostrstream</code> (<code class="filename">strstream</code>) interface is also provided,
219
  with these caveats:
220
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
221
      <code class="code">strstream</code> is considered to be deprecated
222
    </p></li><li class="listitem"><p>
223
      <code class="code">strstream</code> is limited to <code class="code">char</code>
224
    </p></li><li class="listitem"><p>
225
      with <code class="code">ostringstream</code> you don't have to take care of
226
      terminating the string or freeing its memory
227
    </p></li><li class="listitem"><p>
228
      <code class="code">istringstream</code> can be re-filled (clear();
229
      str(input);)
230
    </p></li></ul></div><p>
231
  You can then use output-stringstreams like this:
232
</p><pre class="programlisting">
233
#ifdef HAVE_SSTREAM
234
# include &lt;sstream&gt;
235
#else
236
# include &lt;strstream&gt;
237
#endif
238
 
239
#ifdef HAVE_SSTREAM
240
  std::ostringstream oss;
241
#else
242
  std::ostrstream oss;
243
#endif
244
 
245
oss &lt;&lt; <span class="quote">“<span class="quote">Name=</span>”</span> &lt;&lt; m_name &lt;&lt; <span class="quote">“<span class="quote">, number=</span>”</span> &lt;&lt; m_number &lt;&lt; std::endl;
246
...
247
#ifndef HAVE_SSTREAM
248
  oss &lt;&lt; std::ends; // terminate the char*-string
249
#endif
250
 
251
// str() returns char* for ostrstream and a string for ostringstream
252
// this also causes ostrstream to think that the buffer's memory
253
// is yours
254
m_label.set_text(oss.str());
255
#ifndef HAVE_SSTREAM
256
  // let the ostrstream take care of freeing the memory
257
  oss.freeze(false);
258
#endif
259
</pre><p>
260
      Input-stringstreams can be used similarly:
261
</p><pre class="programlisting">
262
std::string input;
263
...
264
#ifdef HAVE_SSTREAM
265
std::istringstream iss(input);
266
#else
267
std::istrstream iss(input.c_str());
268
#endif
269
 
270
int i;
271
iss &gt;&gt; i;
272
</pre><p> One (the only?) restriction is that an istrstream cannot be re-filled:
273
</p><pre class="programlisting">
274
std::istringstream iss(numerator);
275
iss &gt;&gt; m_num;
276
// this is not possible with istrstream
277
iss.clear();
278
iss.str(denominator);
279
iss &gt;&gt; m_den;
280
</pre><p>
281
If you don't care about speed, you can put these conversions in
282
      a template-function:
283
</p><pre class="programlisting">
284
template &lt;class X&gt;
285
void fromString(const string&amp; input, X&amp; any)
286
{
287
#ifdef HAVE_SSTREAM
288
std::istringstream iss(input);
289
#else
290
std::istrstream iss(input.c_str());
291
#endif
292
X temp;
293
iss &gt;&gt; temp;
294
if (iss.fail())
295
throw runtime_error(..)
296
any = temp;
297
}
298
</pre><p>
299
  Another example of using stringstreams is in <a class="link" href="bk01pt05ch13s05.html" title="Shrink to Fit">this howto</a>.
300
</p><p> There is additional information in the libstdc++-v2 info files, in
301
particular <span class="quote">“<span class="quote">info iostream</span>”</span>.
302
</p></div><div class="sect3" title="Little or no wide character support"><div class="titlepage"><div><div><h4 class="title"><a id="id717171"></a>Little or no wide character support</h4></div></div></div><p>
303
    Classes <code class="classname">wstring</code> and
304
    <code class="classname">char_traits&lt;wchar_t&gt;</code> are
305
    not supported.
306
  </p></div><div class="sect3" title="No templatized iostreams"><div class="titlepage"><div><div><h4 class="title"><a id="id717190"></a>No templatized iostreams</h4></div></div></div><p>
307
    Classes <code class="classname">wfilebuf</code> and
308
    <code class="classname">wstringstream</code> are not supported.
309
  </p></div><div class="sect3" title="Thread safety issues"><div class="titlepage"><div><div><h4 class="title"><a id="id717209"></a>Thread safety issues</h4></div></div></div><p>
310
    Earlier GCC releases had a somewhat different approach to
311
    threading configuration and proper compilation.  Before GCC 3.0,
312
    configuration of the threading model was dictated by compiler
313
    command-line options and macros (both of which were somewhat
314
    thread-implementation and port-specific).  There were no
315
    guarantees related to being able to link code compiled with one
316
    set of options and macro setting with another set.
317
  </p><p>
318
    For GCC 3.0, configuration of the threading model used with
319
    libraries and user-code is performed when GCC is configured and
320
    built using the --enable-threads and --disable-threads options.
321
    The ABI is stable for symbol name-mangling and limited functional
322
    compatibility exists between code compiled under different
323
    threading models.
324
  </p><p>
325
     The libstdc++ library has been designed so that it can be used in
326
     multithreaded applications (with libstdc++-v2 this was only true
327
     of the STL parts.)  The first problem is finding a
328
     <span class="emphasis"><em>fast</em></span> method of implementation portable to
329
     all platforms.  Due to historical reasons, some of the library is
330
     written against per-CPU-architecture spinlocks and other parts
331
     against the gthr.h abstraction layer which is provided by gcc.  A
332
     minor problem that pops up every so often is different
333
     interpretations of what "thread-safe" means for a
334
     library (not a general program).  We currently use the <a class="ulink" href="http://www.sgi.com/tech/stl/thread_safety.html" target="_top">same
335
     definition that SGI</a> uses for their STL subset.  However,
336
     the exception for read-only containers only applies to the STL
337
     components. This definition is widely-used and something similar
338
     will be used in the next version of the C++ standard library.
339
   </p><p>
340
     Here is a small link farm to threads (no pun) in the mail
341
     archives that discuss the threading problem.  Each link is to the
342
     first relevant message in the thread; from there you can use
343
     "Thread Next" to move down the thread.  This farm is in
344
     latest-to-oldest order.
345
   </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
346
            Our threading expert Loren gives a breakdown of <a class="ulink" href="http://gcc.gnu.org/ml/libstdc++/2001-10/msg00024.html" target="_top">the
347
            six situations involving threads</a> for the 3.0
348
            release series.
349
          </p></li><li class="listitem"><p>
350
            <a class="ulink" href="http://gcc.gnu.org/ml/libstdc++/2001-05/msg00384.html" target="_top">
351
        This message</a> inspired a recent updating of issues with
352
        threading and the SGI STL library.  It also contains some
353
        example POSIX-multithreaded STL code.
354
          </p></li></ul></div><p>
355
     (A large selection of links to older messages has been removed;
356
     many of the messages from 1999 were lost in a disk crash, and the
357
     few people with access to the backup tapes have been too swamped
358
     with work to restore them.  Many of the points have been
359
     superseded anyhow.)
360
   </p></div></div><div class="sect2" title="Third"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.third"></a>Third</h3></div></div></div><p> The third generation GNU C++ library is called libstdc++, or
361
libstdc++-v3.
362
</p><p>The subset commonly known as the Standard Template Library
363
         (chapters 23 through 25, mostly) is adapted from the final release
364
         of the SGI STL (version 3.3), with extensive changes.
365
      </p><p>A more formal description of the V3 goals can be found in the
366
         official <a class="link" href="source_design_notes.html" title="Design Notes">design document</a>.
367
      </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" title="Pre-ISO headers moved to backwards or removed"><div class="titlepage"><div><div><h4 class="title"><a id="id706015"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers
368
      (<code class="code">iostream.h</code>, <code class="code">defalloc.h</code> etc.) are
369
      available, unlike previous libstdc++ versions, but inclusion
370
      generates a warning that you are using deprecated headers.
371
</p><p>This compatibility layer is constructed by including the
372
    standard C++ headers, and injecting any items in
373
    <code class="code">std::</code> into the global namespace.
374
   </p><p>For those of you new to ISO C++ (welcome, time travelers!), no,
375
      that isn't a typo. Yes, the headers really have new names.
376
      Marshall Cline's C++ FAQ Lite has a good explanation in <a class="ulink" href="http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.4" target="_top">item
377
      [27.4]</a>.
378
   </p><p> Some include adjustment may be required. What follows is an
379
autoconf test that defines <code class="code">PRE_STDCXX_HEADERS</code> when they
380
exist.</p><pre class="programlisting">
381
# AC_HEADER_PRE_STDCXX
382
AC_DEFUN([AC_HEADER_PRE_STDCXX], [
383
  AC_CACHE_CHECK(for pre-ISO C++ include files,
384
  ac_cv_cxx_pre_stdcxx,
385
  [AC_LANG_SAVE
386
  AC_LANG_CPLUSPLUS
387
  ac_save_CXXFLAGS="$CXXFLAGS"
388
  CXXFLAGS="$CXXFLAGS -Wno-deprecated"
389
 
390
  # Omit defalloc.h, as compilation with newer compilers is problematic.
391
  AC_TRY_COMPILE([
392
  #include &lt;new.h&gt;
393
  #include &lt;iterator.h&gt;
394
  #include &lt;alloc.h&gt;
395
  #include &lt;set.h&gt;
396
  #include &lt;hashtable.h&gt;
397
  #include &lt;hash_set.h&gt;
398
  #include &lt;fstream.h&gt;
399
  #include &lt;tempbuf.h&gt;
400
  #include &lt;istream.h&gt;
401
  #include &lt;bvector.h&gt;
402
  #include &lt;stack.h&gt;
403
  #include &lt;rope.h&gt;
404
  #include &lt;complex.h&gt;
405
  #include &lt;ostream.h&gt;
406
  #include &lt;heap.h&gt;
407
  #include &lt;iostream.h&gt;
408
  #include &lt;function.h&gt;
409
  #include &lt;multimap.h&gt;
410
  #include &lt;pair.h&gt;
411
  #include &lt;stream.h&gt;
412
  #include &lt;iomanip.h&gt;
413
  #include &lt;slist.h&gt;
414
  #include &lt;tree.h&gt;
415
  #include &lt;vector.h&gt;
416
  #include &lt;deque.h&gt;
417
  #include &lt;multiset.h&gt;
418
  #include &lt;list.h&gt;
419
  #include &lt;map.h&gt;
420
  #include &lt;algobase.h&gt;
421
  #include &lt;hash_map.h&gt;
422
  #include &lt;algo.h&gt;
423
  #include &lt;queue.h&gt;
424
  #include &lt;streambuf.h&gt;
425
  ],,
426
  ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
427
  CXXFLAGS="$ac_save_CXXFLAGS"
428
  AC_LANG_RESTORE
429
  ])
430
  if test "$ac_cv_cxx_pre_stdcxx" = yes; then
431
    AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
432
  fi
433
])
434
</pre><p>Porting between pre-ISO headers and ISO headers is simple: headers
435
like <code class="filename">vector.h</code> can be replaced with <code class="filename">vector</code> and a using
436
directive <code class="code">using namespace std;</code> can be put at the global
437
scope. This should be enough to get this code compiling, assuming the
438
other usage is correct.
439
</p></div><div class="sect3" title="Extension headers hash_map, hash_set moved to ext or backwards"><div class="titlepage"><div><div><h4 class="title"><a id="id706097"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been
440
         replaced by standardized libraries.
441
         In particular, the unordered_map and unordered_set containers of TR1
442
         are suitable replacement for the non-standard hash_map and hash_set
443
         containers in the SGI STL.
444
      </p><p> Header files <code class="filename">hash_map</code> and <code class="filename">hash_set</code> moved
445
to <code class="filename">ext/hash_map</code> and  <code class="filename">ext/hash_set</code>,
446
respectively. At the same time, all types in these files are enclosed
447
in <code class="code">namespace __gnu_cxx</code>. Later versions move deprecate
448
these files, and suggest using TR1's  <code class="filename">unordered_map</code>
449
and  <code class="filename">unordered_set</code> instead.
450
</p><p>The extensions are no longer in the global or <code class="code">std</code>
451
         namespaces, instead they are declared in the <code class="code">__gnu_cxx</code>
452
         namespace. For maximum portability, consider defining a namespace
453
         alias to use to talk about extensions, e.g.:
454
      </p><pre class="programlisting">
455
      #ifdef __GNUC__
456
      #if __GNUC__ &lt; 3
457
        #include &lt;hash_map.h&gt;
458
        namespace extension { using ::hash_map; }; // inherit globals
459
      #else
460
        #include &lt;backward/hash_map&gt;
461
        #if __GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ == 0
462
          namespace extension = std;               // GCC 3.0
463
        #else
464
          namespace extension = ::__gnu_cxx;       // GCC 3.1 and later
465
        #endif
466
      #endif
467
      #else      // ...  there are other compilers, right?
468
        namespace extension = std;
469
      #endif
470
 
471
      extension::hash_map&lt;int,int&gt; my_map;
472
      </pre><p>This is a bit cleaner than defining typedefs for all the
473
         instantiations you might need.
474
      </p><p>The following autoconf tests check for working HP/SGI hash containers.
475
</p><pre class="programlisting">
476
# AC_HEADER_EXT_HASH_MAP
477
AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
478
  AC_CACHE_CHECK(for ext/hash_map,
479
  ac_cv_cxx_ext_hash_map,
480
  [AC_LANG_SAVE
481
  AC_LANG_CPLUSPLUS
482
  ac_save_CXXFLAGS="$CXXFLAGS"
483
  CXXFLAGS="$CXXFLAGS -Werror"
484
  AC_TRY_COMPILE([#include &lt;ext/hash_map&gt;], [using __gnu_cxx::hash_map;],
485
  ac_cv_cxx_ext_hash_map=yes, ac_cv_cxx_ext_hash_map=no)
486
  CXXFLAGS="$ac_save_CXXFLAGS"
487
  AC_LANG_RESTORE
488
  ])
489
  if test "$ac_cv_cxx_ext_hash_map" = yes; then
490
    AC_DEFINE(HAVE_EXT_HASH_MAP,,[Define if ext/hash_map is present. ])
491
  fi
492
])
493
</pre><pre class="programlisting">
494
# AC_HEADER_EXT_HASH_SET
495
AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
496
  AC_CACHE_CHECK(for ext/hash_set,
497
  ac_cv_cxx_ext_hash_set,
498
  [AC_LANG_SAVE
499
  AC_LANG_CPLUSPLUS
500
  ac_save_CXXFLAGS="$CXXFLAGS"
501
  CXXFLAGS="$CXXFLAGS -Werror"
502
  AC_TRY_COMPILE([#include &lt;ext/hash_set&gt;], [using __gnu_cxx::hash_set;],
503
  ac_cv_cxx_ext_hash_set=yes, ac_cv_cxx_ext_hash_set=no)
504
  CXXFLAGS="$ac_save_CXXFLAGS"
505
  AC_LANG_RESTORE
506
  ])
507
  if test "$ac_cv_cxx_ext_hash_set" = yes; then
508
    AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
509
  fi
510
])
511
</pre></div><div class="sect3" title="No ios::nocreate/ios::noreplace."><div class="titlepage"><div><div><h4 class="title"><a id="id706200"></a>No <code class="code">ios::nocreate/ios::noreplace</code>.
512
</h4></div></div></div><p> The existence of <code class="code">ios::nocreate</code> being used for
513
input-streams has been confirmed, most probably because the author
514
thought it would be more correct to specify nocreate explicitly.  So
515
it can be left out for input-streams.
516
</p><p>For output streams, <span class="quote">“<span class="quote">nocreate</span>”</span> is probably the default,
517
unless you specify <code class="code">std::ios::trunc</code> ? To be safe, you can
518
open the file for reading, check if it has been opened, and then
519
decide whether you want to create/replace or not. To my knowledge,
520
even older implementations support <code class="code">app</code>, <code class="code">ate</code>
521
and <code class="code">trunc</code> (except for <code class="code">app</code> ?).
522
</p></div><div class="sect3" title="No stream::attach(int fd)"><div class="titlepage"><div><div><h4 class="title"><a id="id703184"></a>
523
No <code class="code">stream::attach(int fd)</code>
524
</h4></div></div></div><p>
525
      Phil Edwards writes: It was considered and rejected for the ISO
526
      standard.  Not all environments use file descriptors.  Of those
527
      that do, not all of them use integers to represent them.
528
    </p><p>
529
      For a portable solution (among systems which use
530
      file descriptors), you need to implement a subclass of
531
      <code class="code">std::streambuf</code> (or
532
      <code class="code">std::basic_streambuf&lt;..&gt;</code>) which opens a file
533
      given a descriptor, and then pass an instance of this to the
534
      stream-constructor.
535
    </p><p>
536
      An extension is available that implements this.
537
      <code class="filename">ext/stdio_filebuf.h</code> contains a derived class called
538
      <a class="ulink" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00074.html" target="_top"><code class="code">__gnu_cxx::stdio_filebuf</code></a>.
539
      This class can be constructed from a C <code class="code">FILE*</code> or a file
540
      descriptor, and provides the <code class="code">fd()</code> function.
541
    </p><p>
542
 For another example of this, refer to
543
      <a class="ulink" href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a>
544
      by Nicolai Josuttis.
545
</p></div><div class="sect3" title="Support for C++98 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id703247"></a>
546
Support for C++98 dialect.
547
</h4></div></div></div><p>Check for complete library coverage of the C++1998/2003 standard.
548
</p><pre class="programlisting">
549
# AC_HEADER_STDCXX_98
550
AC_DEFUN([AC_HEADER_STDCXX_98], [
551
  AC_CACHE_CHECK(for ISO C++ 98 include files,
552
  ac_cv_cxx_stdcxx_98,
553
  [AC_LANG_SAVE
554
  AC_LANG_CPLUSPLUS
555
  AC_TRY_COMPILE([
556
    #include &lt;cassert&gt;
557
    #include &lt;cctype&gt;
558
    #include &lt;cerrno&gt;
559
    #include &lt;cfloat&gt;
560
    #include &lt;ciso646&gt;
561
    #include &lt;climits&gt;
562
    #include &lt;clocale&gt;
563
    #include &lt;cmath&gt;
564
    #include &lt;csetjmp&gt;
565
    #include &lt;csignal&gt;
566
    #include &lt;cstdarg&gt;
567
    #include &lt;cstddef&gt;
568
    #include &lt;cstdio&gt;
569
    #include &lt;cstdlib&gt;
570
    #include &lt;cstring&gt;
571
    #include &lt;ctime&gt;
572
 
573
    #include &lt;algorithm&gt;
574
    #include &lt;bitset&gt;
575
    #include &lt;complex&gt;
576
    #include &lt;deque&gt;
577
    #include &lt;exception&gt;
578
    #include &lt;fstream&gt;
579
    #include &lt;functional&gt;
580
    #include &lt;iomanip&gt;
581
    #include &lt;ios&gt;
582
    #include &lt;iosfwd&gt;
583
    #include &lt;iostream&gt;
584
    #include &lt;istream&gt;
585
    #include &lt;iterator&gt;
586
    #include &lt;limits&gt;
587
    #include &lt;list&gt;
588
    #include &lt;locale&gt;
589
    #include &lt;map&gt;
590
    #include &lt;memory&gt;
591
    #include &lt;new&gt;
592
    #include &lt;numeric&gt;
593
    #include &lt;ostream&gt;
594
    #include &lt;queue&gt;
595
    #include &lt;set&gt;
596
    #include &lt;sstream&gt;
597
    #include &lt;stack&gt;
598
    #include &lt;stdexcept&gt;
599
    #include &lt;streambuf&gt;
600
    #include &lt;string&gt;
601
    #include &lt;typeinfo&gt;
602
    #include &lt;utility&gt;
603
    #include &lt;valarray&gt;
604
    #include &lt;vector&gt;
605
  ],,
606
  ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
607
  AC_LANG_RESTORE
608
  ])
609
  if test "$ac_cv_cxx_stdcxx_98" = yes; then
610
    AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
611
  fi
612
])
613
</pre></div><div class="sect3" title="Support for C++TR1 dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id703275"></a>
614
Support for C++TR1 dialect.
615
</h4></div></div></div><p>Check for library coverage of the TR1 standard.
616
</p><pre class="programlisting">
617
# AC_HEADER_STDCXX_TR1
618
AC_DEFUN([AC_HEADER_STDCXX_TR1], [
619
  AC_CACHE_CHECK(for ISO C++ TR1 include files,
620
  ac_cv_cxx_stdcxx_tr1,
621
  [AC_LANG_SAVE
622
  AC_LANG_CPLUSPLUS
623
  AC_TRY_COMPILE([
624
  #include &lt;tr1/array&gt;
625
  #include &lt;tr1/ccomplex&gt;
626
  #include &lt;tr1/cctype&gt;
627
  #include &lt;tr1/cfenv&gt;
628
  #include &lt;tr1/cfloat&gt;
629
  #include &lt;tr1/cinttypes&gt;
630
  #include &lt;tr1/climits&gt;
631
  #include &lt;tr1/cmath&gt;
632
  #include &lt;tr1/complex&gt;
633
  #include &lt;tr1/cstdarg&gt;
634
  #include &lt;tr1/cstdbool&gt;
635
  #include &lt;tr1/cstdint&gt;
636
  #include &lt;tr1/cstdio&gt;
637
  #include &lt;tr1/cstdlib&gt;
638
  #include &lt;tr1/ctgmath&gt;
639
  #include &lt;tr1/ctime&gt;
640
  #include &lt;tr1/cwchar&gt;
641
  #include &lt;tr1/cwctype&gt;
642
  #include &lt;tr1/functional&gt;
643
  #include &lt;tr1/memory&gt;
644
  #include &lt;tr1/random&gt;
645
  #include &lt;tr1/regex&gt;
646
  #include &lt;tr1/tuple&gt;
647
  #include &lt;tr1/type_traits&gt;
648
  #include &lt;tr1/unordered_set&gt;
649
  #include &lt;tr1/unordered_map&gt;
650
  #include &lt;tr1/utility&gt;
651
  ],,
652
  ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
653
  AC_LANG_RESTORE
654
  ])
655
  if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
656
    AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
657
  fi
658
])
659
</pre><p>An alternative is to check just for specific TR1 includes, such as &lt;unordered_map&gt; and &lt;unordered_set&gt;.
660
</p><pre class="programlisting">
661
# AC_HEADER_TR1_UNORDERED_MAP
662
AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
663
  AC_CACHE_CHECK(for tr1/unordered_map,
664
  ac_cv_cxx_tr1_unordered_map,
665
  [AC_LANG_SAVE
666
  AC_LANG_CPLUSPLUS
667
  AC_TRY_COMPILE([#include &lt;tr1/unordered_map&gt;], [using std::tr1::unordered_map;],
668
  ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
669
  AC_LANG_RESTORE
670
  ])
671
  if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
672
    AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
673
  fi
674
])
675
</pre><pre class="programlisting">
676
# AC_HEADER_TR1_UNORDERED_SET
677
AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
678
  AC_CACHE_CHECK(for tr1/unordered_set,
679
  ac_cv_cxx_tr1_unordered_set,
680
  [AC_LANG_SAVE
681
  AC_LANG_CPLUSPLUS
682
  AC_TRY_COMPILE([#include &lt;tr1/unordered_set&gt;], [using std::tr1::unordered_set;],
683
  ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
684
  AC_LANG_RESTORE
685
  ])
686
  if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
687
    AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
688
  fi
689
])
690
</pre></div><div class="sect3" title="Support for C++0x dialect."><div class="titlepage"><div><div><h4 class="title"><a id="id703319"></a>
691
Support for C++0x dialect.
692
</h4></div></div></div><p>Check for baseline language coverage in the compiler for the C++0xstandard.
693
</p><pre class="programlisting">
694
# AC_COMPILE_STDCXX_OX
695
AC_DEFUN([AC_COMPILE_STDCXX_0X], [
696
  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
697
  ac_cv_cxx_compile_cxx0x_native,
698
  [AC_LANG_SAVE
699
  AC_LANG_CPLUSPLUS
700
  AC_TRY_COMPILE([
701
  template &lt;typename T&gt;
702
    struct check
703
    {
704
      static_assert(sizeof(int) &lt;= sizeof(T), "not big enough");
705
    };
706
 
707
    typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
708
 
709
    int a;
710
    decltype(a) b;
711
 
712
    typedef check&lt;int&gt; check_type;
713
    check_type c;
714
    check_type&amp;&amp; cr = c;],,
715
  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
716
  AC_LANG_RESTORE
717
  ])
718
 
719
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
720
  ac_cv_cxx_compile_cxx0x_cxx,
721
  [AC_LANG_SAVE
722
  AC_LANG_CPLUSPLUS
723
  ac_save_CXXFLAGS="$CXXFLAGS"
724
  CXXFLAGS="$CXXFLAGS -std=c++0x"
725
  AC_TRY_COMPILE([
726
  template &lt;typename T&gt;
727
    struct check
728
    {
729
      static_assert(sizeof(int) &lt;= sizeof(T), "not big enough");
730
    };
731
 
732
    typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
733
 
734
    int a;
735
    decltype(a) b;
736
 
737
    typedef check&lt;int&gt; check_type;
738
    check_type c;
739
    check_type&amp;&amp; cr = c;],,
740
  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
741
  CXXFLAGS="$ac_save_CXXFLAGS"
742
  AC_LANG_RESTORE
743
  ])
744
 
745
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
746
  ac_cv_cxx_compile_cxx0x_gxx,
747
  [AC_LANG_SAVE
748
  AC_LANG_CPLUSPLUS
749
  ac_save_CXXFLAGS="$CXXFLAGS"
750
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
751
  AC_TRY_COMPILE([
752
  template &lt;typename T&gt;
753
    struct check
754
    {
755
      static_assert(sizeof(int) &lt;= sizeof(T), "not big enough");
756
    };
757
 
758
    typedef check&lt;check&lt;bool&gt;&gt; right_angle_brackets;
759
 
760
    int a;
761
    decltype(a) b;
762
 
763
    typedef check&lt;int&gt; check_type;
764
    check_type c;
765
    check_type&amp;&amp; cr = c;],,
766
  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
767
  CXXFLAGS="$ac_save_CXXFLAGS"
768
  AC_LANG_RESTORE
769
  ])
770
 
771
  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
772
     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
773
     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
774
    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
775
  fi
776
])
777
</pre><p>Check for library coverage of the C++0xstandard.
778
</p><pre class="programlisting">
779
# AC_HEADER_STDCXX_0X
780
AC_DEFUN([AC_HEADER_STDCXX_0X], [
781
  AC_CACHE_CHECK(for ISO C++ 0x include files,
782
  ac_cv_cxx_stdcxx_0x,
783
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
784
  AC_LANG_SAVE
785
  AC_LANG_CPLUSPLUS
786
  ac_save_CXXFLAGS="$CXXFLAGS"
787
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
788
 
789
  AC_TRY_COMPILE([
790
    #include &lt;cassert&gt;
791
    #include &lt;ccomplex&gt;
792
    #include &lt;cctype&gt;
793
    #include &lt;cerrno&gt;
794
    #include &lt;cfenv&gt;
795
    #include &lt;cfloat&gt;
796
    #include &lt;cinttypes&gt;
797
    #include &lt;ciso646&gt;
798
    #include &lt;climits&gt;
799
    #include &lt;clocale&gt;
800
    #include &lt;cmath&gt;
801
    #include &lt;csetjmp&gt;
802
    #include &lt;csignal&gt;
803
    #include &lt;cstdarg&gt;
804
    #include &lt;cstdbool&gt;
805
    #include &lt;cstddef&gt;
806
    #include &lt;cstdint&gt;
807
    #include &lt;cstdio&gt;
808
    #include &lt;cstdlib&gt;
809
    #include &lt;cstring&gt;
810
    #include &lt;ctgmath&gt;
811
    #include &lt;ctime&gt;
812
    #include &lt;cwchar&gt;
813
    #include &lt;cwctype&gt;
814
 
815
    #include &lt;algorithm&gt;
816
    #include &lt;array&gt;
817
    #include &lt;bitset&gt;
818
    #include &lt;complex&gt;
819
    #include &lt;deque&gt;
820
    #include &lt;exception&gt;
821
    #include &lt;fstream&gt;
822
    #include &lt;functional&gt;
823
    #include &lt;iomanip&gt;
824
    #include &lt;ios&gt;
825
    #include &lt;iosfwd&gt;
826
    #include &lt;iostream&gt;
827
    #include &lt;istream&gt;
828
    #include &lt;iterator&gt;
829
    #include &lt;limits&gt;
830
    #include &lt;list&gt;
831
    #include &lt;locale&gt;
832
    #include &lt;map&gt;
833
    #include &lt;memory&gt;
834
    #include &lt;new&gt;
835
    #include &lt;numeric&gt;
836
    #include &lt;ostream&gt;
837
    #include &lt;queue&gt;
838
    #include &lt;random&gt;
839
    #include &lt;regex&gt;
840
    #include &lt;set&gt;
841
    #include &lt;sstream&gt;
842
    #include &lt;stack&gt;
843
    #include &lt;stdexcept&gt;
844
    #include &lt;streambuf&gt;
845
    #include &lt;string&gt;
846
    #include &lt;tuple&gt;
847
    #include &lt;typeinfo&gt;
848
    #include &lt;type_traits&gt;
849
    #include &lt;unordered_map&gt;
850
    #include &lt;unordered_set&gt;
851
    #include &lt;utility&gt;
852
    #include &lt;valarray&gt;
853
    #include &lt;vector&gt;
854
  ],,
855
  ac_cv_cxx_stdcxx_0x=yes, ac_cv_cxx_stdcxx_0x=no)
856
  AC_LANG_RESTORE
857
  CXXFLAGS="$ac_save_CXXFLAGS"
858
  ])
859
  if test "$ac_cv_cxx_stdcxx_0x" = yes; then
860
    AC_DEFINE(STDCXX_0X_HEADERS,,[Define if ISO C++ 0x header files are present. ])
861
  fi
862
])
863
</pre><p>As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For &lt;unordered_map&gt;
864
</p><pre class="programlisting">
865
# AC_HEADER_UNORDERED_MAP
866
AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
867
  AC_CACHE_CHECK(for unordered_map,
868
  ac_cv_cxx_unordered_map,
869
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
870
  AC_LANG_SAVE
871
  AC_LANG_CPLUSPLUS
872
  ac_save_CXXFLAGS="$CXXFLAGS"
873
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
874
  AC_TRY_COMPILE([#include &lt;unordered_map&gt;], [using std::unordered_map;],
875
  ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
876
  CXXFLAGS="$ac_save_CXXFLAGS"
877
  AC_LANG_RESTORE
878
  ])
879
  if test "$ac_cv_cxx_unordered_map" = yes; then
880
    AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
881
  fi
882
])
883
</pre><pre class="programlisting">
884
# AC_HEADER_UNORDERED_SET
885
AC_DEFUN([AC_HEADER_UNORDERED_SET], [
886
  AC_CACHE_CHECK(for unordered_set,
887
  ac_cv_cxx_unordered_set,
888
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
889
  AC_LANG_SAVE
890
  AC_LANG_CPLUSPLUS
891
  ac_save_CXXFLAGS="$CXXFLAGS"
892
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
893
  AC_TRY_COMPILE([#include &lt;unordered_set&gt;], [using std::unordered_set;],
894
  ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
895
  CXXFLAGS="$ac_save_CXXFLAGS"
896
  AC_LANG_RESTORE
897
  ])
898
  if test "$ac_cv_cxx_unordered_set" = yes; then
899
    AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
900
  fi
901
])
902
</pre></div><div class="sect3" title="Container::iterator_type is not necessarily Container::value_type*"><div class="titlepage"><div><div><h4 class="title"><a id="id703396"></a>
903
  Container::iterator_type is not necessarily Container::value_type*
904
</h4></div></div></div><p>
905
  This is a change in behavior from the previous version. Now, most
906
  <span class="type">iterator_type</span> typedefs in container classes are POD
907
  objects, not <span class="type">value_type</span> pointers.
908
</p></div></div><div class="bibliography" title="Bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry" title="Migrating to GCC 4.1"><a id="id703425"></a><p>[<abbr class="abbrev">
909
      kegel41
910
    </abbr>] <span class="title"><i>
911
      Migrating to GCC 4.1
912
    </i>. </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span><span class="biblioid">
913
      <a class="ulink" href="http://www.kegel.com/gcc/gcc4.html" target="_top">
914
      </a>
915
    . </span></p></div><div class="biblioentry" title="Building the Whole Debian Archive with GCC 4.1: A Summary"><a id="id703458"></a><p>[<abbr class="abbrev">
916
      kegel41
917
    </abbr>] <span class="title"><i>
918
      Building the Whole Debian Archive with GCC 4.1: A Summary
919
    </i>. </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span><span class="biblioid">
920
      <a class="ulink" href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html" target="_top">
921
      </a>
922
    . </span></p></div><div class="biblioentry" title="Migration guide for GCC-3.2"><a id="id703491"></a><p>[<abbr class="abbrev">
923
      lbl32
924
    </abbr>] <span class="title"><i>
925
      Migration guide for GCC-3.2
926
    </i>. </span><span class="biblioid">
927
      <a class="ulink" href="http://annwm.lbl.gov/~leggett/Atlas/gcc-3.2.html" target="_top">
928
      </a>
929
    . </span></p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_porting.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="appendix_free.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">API Evolution and Deprecation History </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix C. 
930
  Free Software Needs Free Documentation
931
 
932
</td></tr></table></div></body></html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.