mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-11 19:49:32 +00:00
164 lines
34 KiB
HTML
164 lines
34 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Headers</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using.html" title="Chapter 3. Using" /><link rel="next" href="using_macros.html" title="Macros" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_macros.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.headers"></a>Headers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.all"></a>Header Files</h3></div></div></div><p>
|
||
The C++ standard specifies the entire set of header files that
|
||
must be available to all hosted implementations. Actually, the
|
||
word "files" is a misnomer, since the contents of the
|
||
headers don't necessarily have to be in any kind of external
|
||
file. The only rule is that when one <code class="code">#include</code>s a
|
||
header, the contents of that header become available, no matter
|
||
how.
|
||
</p><p>
|
||
That said, in practice files are used.
|
||
</p><p>
|
||
There are two main types of include files: header files related
|
||
to a specific version of the ISO C++ standard (called Standard
|
||
Headers), and all others (TS, TR1, C++ ABI, and Extensions).
|
||
</p><p>
|
||
Multiple dialects of standard headers are supported, corresponding to
|
||
the 1998 standard as updated for 2003, the 2011 standard, the 2014
|
||
standard, and so on.
|
||
</p><p>
|
||
<a class="xref" href="using_headers.html#table.cxx98_headers" title="Table 3.2. C++ 1998 Library Headers">Table 3.2, “C++ 1998 Library Headers”</a> and
|
||
<a class="xref" href="using_headers.html#table.cxx98_cheaders" title="Table 3.3. C++ 1998 Library Headers for C Library Facilities">Table 3.3, “C++ 1998 Library Headers for C Library Facilities”</a> and
|
||
<a class="xref" href="using_headers.html#table.cxx98_deprheaders" title="Table 3.4. C++ 1998 Deprecated Library Header">Table 3.4, “C++ 1998 Deprecated Library Header”</a>
|
||
show the C++98/03 include files.
|
||
These are available in the C++98 compilation mode,
|
||
i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>.
|
||
Unless specified otherwise below, they are also available in later modes
|
||
(C++11, C++14 etc).
|
||
</p><div class="table"><a id="table.cxx98_headers"></a><p class="title"><strong>Table 3.2. C++ 1998 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td colspan="3" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx98_cheaders"></a><p class="title"><strong>Table 3.3. C++ 1998 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
The following header is deprecated
|
||
and might be removed from a future C++ standard.
|
||
</p><div class="table"><a id="table.cxx98_deprheaders"></a><p class="title"><strong>Table 3.4. C++ 1998 Deprecated Library Header</strong></p><div class="table-contents"><table class="table" summary="C++ 1998 Deprecated Library Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">strstream</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.cxx11_headers" title="Table 3.5. C++ 2011 Library Headers">Table 3.5, “C++ 2011 Library Headers”</a> and
|
||
<a class="xref" href="using_headers.html#table.cxx11_cheaders" title="Table 3.6. C++ 2011 Library Headers for C Library Facilities">Table 3.6, “C++ 2011 Library Headers for C Library Facilities”</a> show the C++11 include files.
|
||
These are available in C++11 compilation
|
||
mode, i.e. <code class="literal">-std=c++11</code> or <code class="literal">-std=gnu++11</code>.
|
||
Including these headers in C++98/03 mode may result in compilation errors.
|
||
Unless specified otherwise below, they are also available in later modes
|
||
(C++14 etc).
|
||
</p><p></p><div class="table"><a id="table.cxx11_headers"></a><p class="title"><strong>Table 3.5. C++ 2011 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">atomic</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">codecvt</code></td><td align="left"><code class="filename">condition_variable</code></td></tr><tr><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">mutex</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">scoped_allocator</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">typeindex</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.cxx11_cheaders"></a><p class="title"><strong>Table 3.6. C++ 2011 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ 2011 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cfenv</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">cstdalign</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">cuchar</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.cxx14_headers" title="Table 3.7. C++ 2014 Library Header">Table 3.7, “C++ 2014 Library Header”</a> shows the C++14 include file.
|
||
This is available in C++14 compilation
|
||
mode, i.e. <code class="literal">-std=c++14</code> or <code class="literal">-std=gnu++14</code>.
|
||
Including this header in C++98/03 mode or C++11 will not result in
|
||
compilation errors, but will not define anything.
|
||
Unless specified otherwise below, it is also available in later modes
|
||
(C++17 etc).
|
||
</p><p></p><div class="table"><a id="table.cxx14_headers"></a><p class="title"><strong>Table 3.7. C++ 2014 Library Header</strong></p><div class="table-contents"><table class="table" summary="C++ 2014 Library Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">shared_mutex</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.cxx17_headers" title="Table 3.8. C++ 2017 Library Headers">Table 3.8, “C++ 2017 Library Headers”</a> shows the C++17 include files.
|
||
These are available in C++17 compilation
|
||
mode, i.e. <code class="literal">-std=c++17</code> or <code class="literal">-std=gnu++17</code>.
|
||
Including these headers in earlier modes will not result in
|
||
compilation errors, but will not define anything.
|
||
Unless specified otherwise below, they are also available in later modes
|
||
(C++20 etc).
|
||
</p><p></p><div class="table"><a id="table.cxx17_headers"></a><p class="title"><strong>Table 3.8. C++ 2017 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2017 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">any</code></td><td align="left"><code class="filename">charconv</code></td><td align="left"><code class="filename">execution</code></td><td align="left"><code class="filename">filesystem</code></td><td align="left"><code class="filename">memory_resource</code></td></tr><tr><td align="left"><code class="filename">optional</code></td><td align="left"><code class="filename">string_view</code></td><td align="left"><code class="filename">variant</code></td><td colspan="2" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.cxx20_headers" title="Table 3.9. C++ 2020 Library Headers">Table 3.9, “C++ 2020 Library Headers”</a>
|
||
shows the C++2a include files.
|
||
These are available in C++2a compilation
|
||
mode, i.e. <code class="literal">-std=c++2a</code> or <code class="literal">-std=gnu++2a</code>.
|
||
Including these headers in earlier modes will not result in
|
||
compilation errors, but will not define anything.
|
||
|
||
</p><p></p><div class="table"><a id="table.cxx20_headers"></a><p class="title"><strong>Table 3.9. C++ 2020 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2020 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">bit</code></td><td align="left"><code class="filename">version</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
The following headers have been removed in the C++2a working draft.
|
||
They are still available when using this implementation, but in future
|
||
they might start to produce warnings or errors when included in C++2a mode.
|
||
Programs that intend to be portable should not include them.
|
||
</p><div class="table"><a id="table.cxx20_deprheaders"></a><p class="title"><strong>Table 3.10. C++ 2020 Obsolete Headers</strong></p><div class="table-contents"><table class="table" summary="C++ 2020 Obsolete Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">cstdalign</code></td><td align="left"><code class="filename">cstdbool</code></td><td align="left"><code class="filename">ctgmath</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.filesystemts_headers" title="Table 3.11. File System TS Header">Table 3.11, “File System TS Header”</a>,
|
||
shows the additional include file define by the
|
||
File System Technical Specification, ISO/IEC TS 18822.
|
||
This is available in C++11 and later compilation modes.
|
||
Including this header in earlier modes will not result in
|
||
compilation errors, but will not define anything.
|
||
</p><p></p><div class="table"><a id="table.filesystemts_headers"></a><p class="title"><strong>Table 3.11. File System TS Header</strong></p><div class="table-contents"><table class="table" summary="File System TS Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">experimental/filesystem</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
<a class="xref" href="using_headers.html#table.libfundts_headers" title="Table 3.12. Library Fundamentals TS Headers">Table 3.12, “Library Fundamentals TS Headers”</a>,
|
||
shows the additional include files define by the C++ Extensions for
|
||
Library Fundamentals Technical Specification, ISO/IEC TS 19568.
|
||
These are available in C++14 and later compilation modes.
|
||
Including these headers in earlier modes will not result in
|
||
compilation errors, but will not define anything.
|
||
</p><p></p><div class="table"><a id="table.libfundts_headers"></a><p class="title"><strong>Table 3.12. Library Fundamentals TS Headers</strong></p><div class="table-contents"><table class="table" summary="Library Fundamentals TS Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">experimental/algorithm</code></td><td align="left"><code class="filename">experimental/any</code></td><td align="left"><code class="filename">experimental/array</code></td><td align="left"><code class="filename">experimental/chrono</code></td><td align="left"><code class="filename">experimental/deque</code></td></tr><tr><td align="left"><code class="filename">experimental/forward_list</code></td><td align="left"><code class="filename">experimental/functional</code></td><td align="left"><code class="filename">experimental/iterator</code></td><td align="left"><code class="filename">experimental/list</code></td><td align="left"><code class="filename">experimental/map</code></td></tr><tr><td align="left"><code class="filename">experimental/memory</code></td><td align="left"><code class="filename">experimental/memory_resource</code></td><td align="left"><code class="filename">experimental/numeric</code></td><td align="left"><code class="filename">experimental/optional</code></td><td align="left"><code class="filename">experimental/propagate_const</code></td></tr><tr><td align="left"><code class="filename">experimental/random</code></td><td align="left"><code class="filename">experimental/ratio</code></td><td align="left"><code class="filename">experimental/regex</code></td><td align="left"><code class="filename">experimental/set</code></td><td align="left"><code class="filename">experimental/source_location</code></td></tr><tr><td align="left"><code class="filename">experimental/string</code></td><td align="left"><code class="filename">experimental/string_view</code></td><td align="left"><code class="filename">experimental/system_error</code></td><td align="left"><code class="filename">experimental/tuple</code></td><td align="left"><code class="filename">experimental/type_traits</code></td></tr><tr><td align="left"><code class="filename">experimental/unordered_map</code></td><td align="left"><code class="filename">experimental/unordered_set</code></td><td align="left"><code class="filename">experimental/utility</code></td><td align="left"><code class="filename">experimental/vector</code></td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
In addition, TR1 includes as:
|
||
</p><div class="table"><a id="table.tr1_headers"></a><p class="title"><strong>Table 3.13. C++ TR 1 Library Headers</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.tr1_cheaders"></a><p class="title"><strong>Table 3.14. C++ TR 1 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table class="table" summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++
|
||
compiler supports scalar decimal floating-point types defined via
|
||
<code class="code">__attribute__((mode(SD|DD|LD)))</code>.
|
||
</p><div class="table"><a id="table.decfp_headers"></a><p class="title"><strong>Table 3.15. C++ TR 24733 Decimal Floating-Point Header</strong></p><div class="table-contents"><table class="table" summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
Also included are files for the C++ ABI interface:
|
||
</p><div class="table"><a id="table.abi_headers"></a><p class="title"><strong>Table 3.16. C++ ABI Headers</strong></p><div class="table-contents"><table class="table" summary="C++ ABI Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
|
||
And a large variety of extensions.
|
||
</p><div class="table"><a id="table.ext_headers"></a><p class="title"><strong>Table 3.17. Extension Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.debug_headers"></a><p class="title"><strong>Table 3.18. Extension Debug Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Debug Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/array</code></td><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/forward_list</code></td><td align="left"><code class="filename">debug/list</code></td></tr><tr><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td></tr><tr><td align="left"><code class="filename">debug/vector</code></td><td colspan="4" align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.profile_headers"></a><p class="title"><strong>Table 3.19. Extension Profile Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Profile Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="table.parallel_headers"></a><p class="title"><strong>Table 3.20. Extension Parallel Headers</strong></p><div class="table-contents"><table class="table" summary="Extension Parallel Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules.
|
||
</p><p>First, mixing different dialects of the standard headers is not
|
||
possible. It's an all-or-nothing affair. Thus, code like
|
||
</p><pre class="programlisting">
|
||
#include <array>
|
||
#include <functional>
|
||
</pre><p>Implies C++11 mode. To use the entities in <array>, the C++11
|
||
compilation mode must be used, which implies the C++11 functionality
|
||
(and deprecations) in <functional> will be present.
|
||
</p><p>Second, the other headers can be included with either dialect of
|
||
the standard headers, although features and types specific to C++11
|
||
are still only enabled when in C++11 compilation mode. So, to use
|
||
rvalue references with <code class="code">__gnu_cxx::vstring</code>, or to use the
|
||
debug-mode versions of <code class="code">std::unordered_map</code>, one must use
|
||
the <code class="code">std=gnu++11</code> compiler flag. (Or <code class="code">std=c++11</code>, of course.)
|
||
</p><p>A special case of the second rule is the mixing of TR1 and C++11
|
||
facilities. It is possible (although not especially prudent) to
|
||
include both the TR1 version and the C++11 version of header in the
|
||
same translation unit:
|
||
</p><pre class="programlisting">
|
||
#include <tr1/type_traits>
|
||
#include <type_traits>
|
||
</pre><p> Several parts of C++11 diverge quite substantially from TR1 predecessors.
|
||
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.cheaders"></a>The C Headers and <code class="code">namespace std</code></h3></div></div></div><p>
|
||
The standard specifies that if one includes the C-style header
|
||
(<math.h> in this case), the symbols will be available
|
||
in the global namespace and perhaps in
|
||
namespace <code class="code">std::</code> (but this is no longer a firm
|
||
requirement.) On the other hand, including the C++-style
|
||
header (<cmath>) guarantees that the entities will be
|
||
found in namespace std and perhaps in the global namespace.
|
||
</p><p>
|
||
Usage of C++-style headers is recommended, as then
|
||
C-linkage names can be disambiguated by explicit qualification, such
|
||
as by <code class="code">std::abort</code>. In addition, the C++-style headers can
|
||
use function overloading to provide a simpler interface to certain
|
||
families of C-functions. For instance in <cmath>, the
|
||
function <code class="code">std::sin</code> has overloads for all the builtin
|
||
floating-point types. This means that <code class="code">std::sin</code> can be
|
||
used uniformly, instead of a combination
|
||
of <code class="code">std::sinf</code>, <code class="code">std::sin</code>,
|
||
and <code class="code">std::sinl</code>.
|
||
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.pre"></a>Precompiled Headers</h3></div></div></div><p>There are three base header files that are provided. They can be
|
||
used to precompile the standard headers and extensions into binary
|
||
files that may then be used to speed up compilations that use these headers.
|
||
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>stdc++.h</p><p>Includes all standard headers. Actual content varies depending on
|
||
<a class="link" href="using.html#manual.intro.using.flags" title="Command Options">language dialect</a>.
|
||
</p></li><li class="listitem"><p>stdtr1c++.h</p><p>Includes all of <stdc++.h>, and adds all the TR1 headers.
|
||
</p></li><li class="listitem"><p>extc++.h</p><p>Includes all of <stdc++.h>, and adds all the Extension headers
|
||
(and in C++98 mode also adds all the TR1 headers by including all of
|
||
<stdtr1c++.h>).
|
||
</p></li></ul></div><p>To construct a .gch file from one of these base header files,
|
||
first find the include directory for the compiler. One way to do
|
||
this is:</p><pre class="programlisting">
|
||
g++ -v hello.cc
|
||
|
||
#include <...> search starts here:
|
||
/mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0
|
||
...
|
||
End of search list.
|
||
</pre><p>Then, create a precompiled header file with the same flags that
|
||
will be used to compile other projects.</p><pre class="programlisting">
|
||
g++ -Winvalid-pch -x c++-header -g -O2 -o ./stdc++.h.gch /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h
|
||
</pre><p>The resulting file will be quite large: the current size is around
|
||
thirty megabytes. </p><p>How to use the resulting file.</p><pre class="programlisting">
|
||
g++ -I. -include stdc++.h -H -g -O2 hello.cc
|
||
</pre><p>Verification that the PCH file is being used is easy:</p><pre class="programlisting">
|
||
g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe
|
||
! ./stdc++.h.gch
|
||
. /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/iostream
|
||
. /mnt/share/bld/H-x86-gcc.20071201include/c++/4.3.0/string
|
||
</pre><p>The exclamation point to the left of the <code class="code">stdc++.h.gch</code> listing means that the generated PCH file was used.</p><p></p><p> Detailed information about creating precompiled header files can be found in the GCC <a class="link" href="http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html" target="_top">documentation</a>.
|
||
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="using_macros.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Using </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Macros</td></tr></table></div></body></html> |