From: Jonathan Wakely Date: Wed, 8 Aug 2018 15:40:32 +0000 (+0100) Subject: Improve libstdc++ docs w.r.t newer C++ standards X-Git-Tag: releases/gcc-6.5.0~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=096783e4fad09e74b943578efc84c67c3bdc0ded;p=thirdparty%2Fgcc.git Improve libstdc++ docs w.r.t newer C++ standards Instead of repeating all the old headers for every new standard I've changed the docs to only list the new headers for each standard. Backport from mainline 2018-07-31 Jonathan Wakely * doc/xml/manual/using.xml: Document all headers for C++11 and later. * doc/html/*: Regenerate. From-SVN: r263418 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 59f02c82be1b..232224dca587 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2018-08-08 Jonathan Wakely + Backport from mainline + 2018-07-31 Jonathan Wakely + + * doc/xml/manual/using.xml: Document all headers for C++11 and later. + * doc/html/*: Regenerate. + Backport from mainline 2018-08-03 Jonathan Wakely diff --git a/libstdc++-v3/doc/html/manual/index.html b/libstdc++-v3/doc/html/manual/index.html index 3a098d9445fa..427f3f063d0f 100644 --- a/libstdc++-v3/doc/html/manual/index.html +++ b/libstdc++-v3/doc/html/manual/index.html @@ -149,7 +149,7 @@ Support for C++11 dialect.
22.10. Non-unique Mapping Containers
22.11. Point Iterator Hierarchy
22.12. Invalidation Guarantee Tags Hierarchy
22.13. Container Tag Hierarchy
22.14. Hash functions, ranged-hash functions, and range-hashing functions
22.15. Insert hash sequence diagram
22.16. Insert hash sequence diagram with a null policy
22.17. Hash policy class diagram
22.18. Balls and bins
22.19. Insert resize sequence diagram
22.20. Standard resize policy trigger sequence diagram
22.21. Standard resize policy size sequence - diagram
22.22. Tree node invariants
22.23. Tree node invalidation
22.24. A tree and its update policy
22.25. Restoring node invariants
22.26. Insert update sequence
22.27. Useless update path
22.28. A PATRICIA trie
22.29. A trie and its update policy
22.30. A simple list
22.31. The counter algorithm
22.32. Underlying Priority-Queue Data-Structures.
22.33. Priority-Queue Data-Structure Tags.
B.1. Configure and Build File Dependencies

List of Equations

22.1. Ranged Hash Function
22.2. Range-Hashing, Division Method
22.3. Division via Prime Modulo
22.4. Division via Bit Mask
22.5. A Standard String Hash Function
22.6. Only k String DNA Hash diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html index a25323d40ecc..e2088925cafe 100644 --- a/libstdc++-v3/doc/html/manual/using_headers.html +++ b/libstdc++-v3/doc/html/manual/using_headers.html @@ -4,7 +4,7 @@ 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 #include's a + file. The only rule is that when one #includes a header, the contents of that header become available, no matter how.

@@ -12,25 +12,63 @@

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 (TR1, C++ ABI, and Extensions). + Headers), and all others (TS, TR1, C++ ABI, and Extensions).

- Two dialects of standard headers are supported, corresponding to - the 1998 standard as updated for 2003, and the current 2011 standard. + 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.

- C++98/03 include files. These are available in the default compilation mode, i.e. -std=c++98 or -std=gnu++98. -

Table 3.2. C++ 1998 Library Headers

algorithmbitsetcomplexdequeexception
fstreamfunctionaliomanipiosiosfwd
iostreamistreamiteratorlimitslist
localemapmemorynewnumeric
ostreamqueuesetsstreamstack
stdexceptstreambufstringutilitytypeinfo
valarrayvector   

Table 3.3. C++ 1998 Library Headers for C Library Facilities

cassertcerrnocctypecfloatciso646
climitsclocalecmathcsetjmpcsignal
cstdargcstddefcstdiocstdlibcstring
ctimecwcharcwctype  

-C++11 include files. These are only available in C++11 compilation + Table 3.2, “C++ 1998 Library Headers” and + Table 3.3, “C++ 1998 Library Headers for C Library Facilities” and + Table 3.4, “C++ 1998 Deprecated Library Header” + show the C++98/03 include files. + These are available in the C++98 compilation mode, + i.e. -std=c++98 or -std=gnu++98. + Unless specified otherwise below, they are also available in later modes + (C++11, C++14 etc). +

Table 3.2. C++ 1998 Library Headers

algorithmbitsetcomplexdequeexception
fstreamfunctionaliomanipiosiosfwd
iostreamistreamiteratorlimitslist
localemapmemorynewnumeric
ostreamqueuesetsstreamstack
stdexceptstreambufstringutilitytypeinfo
valarrayvector 

Table 3.3. C++ 1998 Library Headers for C Library Facilities

cassertcerrnocctypecfloatciso646
climitsclocalecmathcsetjmpcsignal
cstdargcstddefcstdiocstdlibcstring
ctimecwcharcwctype 

+ The following header is deprecated + and might be removed from a future C++ standard. +

Table 3.4. C++ 1998 Deprecated Library Header

strstream

+Table 3.5, “C++ 2011 Library Headers” and +Table 3.6, “C++ 2011 Library Headers for C Library Facilities” show the C++11 include files. +These are available in C++11 compilation mode, i.e. -std=c++11 or -std=gnu++11. -

Table 3.4. C++ 2011 Library Headers

algorithmarraybitsetchronocomplex
condition_variabledequeexceptionforward_listfstream
functionalfutureinitalizer_listiomanipios
iosfwdiostreamistreamiteratorlimits
listlocalemapmemorymutex
newnumericostreamqueuerandom
ratioregexsetsstreamstack
stdexceptstreambufstringsystem_errorthread
tupletype_traitstypeinfounordered_mapunordered_set
utilityvalarrayvector  

Table 3.5. C++ 2011 Library Headers for C Library Facilities

cassertccomplexcctypecerrnocfenv
cfloatcinttypesciso646climitsclocale
cmathcsetjmpcsignalcstdargcstdbool
cstddefcstdintcstdlibcstdiocstring
ctgmathctimecucharcwcharcwctype

+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). +

Table 3.5. C++ 2011 Library Headers

arrayatomicchronocodecvtcondition_variable
forward_listfutureinitalizer_listmutexrandom
ratioregexscoped_allocatorsystem_errorthread
tupletypeindextype_traitsunordered_mapunordered_set

Table 3.6. C++ 2011 Library Headers for C Library Facilities

ccomplexcfenvcinttypescstdaligncstdbool
cstdintctgmathcuchar 

+Table 3.7, “C++ 2014 Library Header” shows the C++14 include file. +This is available in C++14 compilation +mode, i.e. -std=c++14 or -std=gnu++14. +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). +

Table 3.7. C++ 2014 Library Header

shared_mutex

+Table 3.8, “File System TS Header”, +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. +

Table 3.8. File System TS Header

experimental/filesystem

+Table 3.9, “Library Fundamentals TS Headers”, +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. +

Table 3.9. Library Fundamentals TS Headers

experimental/algorithmexperimental/anyexperimental/arrayexperimental/chronoexperimental/deque
experimental/forward_listexperimental/functionalexperimental/iteratorexperimental/listexperimental/map
experimental/memoryexperimental/memory_resourceexperimental/numericexperimental/optionalexperimental/propagate_const
experimental/randomexperimental/ratioexperimental/regexexperimental/setexperimental/string
experimental/string_viewexperimental/system_errorexperimental/tupleexperimental/type_traitsexperimental/unordered_map
experimental/unordered_setexperimental/utilityexperimental/vector 

In addition, TR1 includes as: -

Table 3.6. C++ TR 1 Library Headers

tr1/arraytr1/complextr1/memorytr1/functionaltr1/random
tr1/regextr1/tupletr1/type_traitstr1/unordered_maptr1/unordered_set
tr1/utility    

Table 3.7. C++ TR 1 Library Headers for C Library Facilities

tr1/ccomplextr1/cfenvtr1/cfloattr1/cmathtr1/cinttypes
tr1/climitstr1/cstdargtr1/cstdbooltr1/cstdinttr1/cstdio
tr1/cstdlibtr1/ctgmathtr1/ctimetr1/cwchartr1/cwctype

Decimal floating-point arithmetic is available if the C++ +

Table 3.10. C++ TR 1 Library Headers

tr1/arraytr1/complextr1/memorytr1/functionaltr1/random
tr1/regextr1/tupletr1/type_traitstr1/unordered_maptr1/unordered_set
tr1/utility 

Table 3.11. C++ TR 1 Library Headers for C Library Facilities

tr1/ccomplextr1/cfenvtr1/cfloattr1/cmathtr1/cinttypes
tr1/climitstr1/cstdargtr1/cstdbooltr1/cstdinttr1/cstdio
tr1/cstdlibtr1/ctgmathtr1/ctimetr1/cwchartr1/cwctype

Decimal floating-point arithmetic is available if the C++ compiler supports scalar decimal floating-point types defined via __attribute__((mode(SD|DD|LD))). -

Table 3.8. C++ TR 24733 Decimal Floating-Point Header

decimal/decimal

+

Table 3.12. C++ TR 24733 Decimal Floating-Point Header

decimal/decimal

Also included are files for the C++ ABI interface: -

Table 3.9. C++ ABI Headers

cxxabi.hcxxabi_forced.h

+

Table 3.13. C++ ABI Headers

cxxabi.hcxxabi_forced.h

And a large variety of extensions. -

Table 3.10. Extension Headers

ext/algorithmext/atomicity.hext/array_allocator.hext/bitmap_allocator.hext/cast.h
ext/codecvt_specializations.hext/concurrence.hext/debug_allocator.hext/enc_filebuf.hext/extptr_allocator.h
ext/functionalext/iteratorext/malloc_allocator.hext/memoryext/mt_allocator.h
ext/new_allocator.hext/numericext/numeric_traits.hext/pb_ds/assoc_container.hext/pb_ds/priority_queue.h
ext/pod_char_traits.hext/pool_allocator.hext/rb_treeext/ropeext/slist
ext/stdio_filebuf.hext/stdio_sync_filebuf.hext/throw_allocator.hext/typelist.hext/type_traits.h
ext/vstring.h    

Table 3.11. Extension Debug Headers

debug/bitsetdebug/dequedebug/listdebug/mapdebug/set
debug/stringdebug/unordered_mapdebug/unordered_setdebug/vector 

Table 3.12. Extension Profile Headers

profile/bitsetprofile/dequeprofile/listprofile/map
profile/setprofile/unordered_mapprofile/unordered_setprofile/vector

Table 3.13. Extension Parallel Headers

parallel/algorithmparallel/numeric

Mixing Headers

A few simple rules. +

Table 3.14. Extension Headers

ext/algorithmext/atomicity.hext/array_allocator.hext/bitmap_allocator.hext/cast.h
ext/codecvt_specializations.hext/concurrence.hext/debug_allocator.hext/enc_filebuf.hext/extptr_allocator.h
ext/functionalext/iteratorext/malloc_allocator.hext/memoryext/mt_allocator.h
ext/new_allocator.hext/numericext/numeric_traits.hext/pb_ds/assoc_container.hext/pb_ds/priority_queue.h
ext/pod_char_traits.hext/pool_allocator.hext/rb_treeext/ropeext/slist
ext/stdio_filebuf.hext/stdio_sync_filebuf.hext/throw_allocator.hext/typelist.hext/type_traits.h
ext/vstring.h 

Table 3.15. Extension Debug Headers

debug/arraydebug/bitsetdebug/dequedebug/forward_listdebug/list
debug/mapdebug/setdebug/stringdebug/unordered_mapdebug/unordered_set
debug/vector 

Table 3.16. Extension Profile Headers

profile/bitsetprofile/dequeprofile/listprofile/map
profile/setprofile/unordered_mapprofile/unordered_setprofile/vector

Table 3.17. Extension Parallel Headers

parallel/algorithmparallel/numeric

Mixing Headers

A few simple rules.

First, mixing different dialects of the standard headers is not possible. It's an all-or-nothing affair. Thus, code like

diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
index 6822655119eb..64aba6904eed 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -126,7 +126,7 @@
      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 #include's a
+     file.  The only rule is that when one #includes a
      header, the contents of that header become available, no matter
      how.
    
@@ -138,16 +138,24 @@
    
      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 (TR1, C++ ABI, and Extensions).
+     Headers), and all others (TS, TR1, C++ ABI, and Extensions).
    
 
    
-     Two dialects of standard headers are supported, corresponding to
-     the 1998 standard as updated for 2003, and the current 2011 standard.
+     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.
    
 
    
-     C++98/03 include files. These are available in the default compilation mode, i.e. -std=c++98 or -std=gnu++98.
+      and
+      and
+     
+     show the C++98/03 include files.
+     These are available in the C++98 compilation mode,
+     i.e. -std=c++98 or -std=gnu++98.
+     Unless specified otherwise below, they are also available in later modes
+     (C++11, C++14 etc).
    
 
 
@@ -205,6 +213,7 @@
 
 valarray
 vector
+
 
@@ -246,14 +255,38 @@
 ctimecwcharcwctype
+
 
 
 
 
-C++11 include files. These are only available in C++11 compilation + The following header is deprecated + and might be removed from a future C++ standard. + + + +C++ 1998 Deprecated Library Header + + + + + +strstream + + + +
+ + + and + show the C++11 include files. +These are available in C++11 compilation mode, i.e. -std=c++11 or -std=gnu++11. +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). @@ -269,73 +302,33 @@ mode, i.e. -std=c++11 or -std=gnu++11. -algorithm array -bitset +atomic chrono -complex - - +codecvt condition_variable -deque -exception -forward_list -fstream -functional +forward_list future initalizer_list -iomanip -ios - - -iosfwd -iostream -istream -iterator -limits - - -list -locale -map -memory mutex - - -new -numeric -ostream -queue random ratio regex -set -sstream -stack - - -stdexcept -streambuf -string +scoped_allocator system_error thread tuple +typeindex type_traits -typeinfo unordered_map unordered_set - -utility -valarray -vector - @@ -354,39 +347,130 @@ mode, i.e. -std=c++11 or -std=gnu++11. -cassert ccomplex -cctype -cerrno cfenv +cinttypes +cstdalign +cstdbool -cfloat -cinttypes -ciso646 -climits -clocale +cstdint +ctgmath +cuchar + + + + + + + shows the C++14 include file. +This is available in C++14 compilation +mode, i.e. -std=c++14 or -std=gnu++14. +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). + + + + +C++ 2014 Library Header + + + + -cmath -csetjmp -csignal -cstdarg -cstdbool +shared_mutex + + +
+ + +, +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. + + + + +File System TS Header + + + + -cstddef -cstdint -cstdlib -cstdio -cstring +experimental/filesystem + + + +
+ + + +, +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. + + + + +Library Fundamentals TS Headers + + + + + + + + + +experimental/algorithm +experimental/any +experimental/array +experimental/chrono +experimental/deque -ctgmath -ctime -cuchar -cwchar -cwctype +experimental/forward_list +experimental/functional +experimental/iterator +experimental/list +experimental/map + + +experimental/memory +experimental/memory_resource +experimental/numeric +experimental/optional +experimental/propagate_const + + +experimental/random +experimental/ratio +experimental/regex +experimental/set +experimental/string + + +experimental/string_view +experimental/system_error +experimental/tuple +experimental/type_traits +experimental/unordered_map + + +experimental/unordered_set +experimental/utility +experimental/vector + @@ -424,6 +508,7 @@ mode, i.e. -std=c++11 or -std=gnu++11. tr1/utility + @@ -564,6 +649,7 @@ compiler supports scalar decimal floating-point types defined via ext/vstring.h + @@ -584,18 +670,22 @@ compiler supports scalar decimal floating-point types defined via +debug/array debug/bitset debug/deque +debug/forward_list debug/list -debug/map -debug/set - +debug/map +debug/set debug/string debug/unordered_map debug/unordered_set + + debug/vector +